
if (!(GBrowserIsCompatible())) 
{
	alert("Your browser is not compatible. I'd recommend Firefox.");
}
else 
{
}

Gskirm.prototype.mapStart = function()
{
	this.map = new GMap2(document.getElementById("map"));
	this.map.addControl(new gameControl());
	this.map.addControl(new battleScores());
	//this.map.addControl(new turnControl());
	this.map.setCenter(new GLatLng(40, 10), 2, G_SATELLITE_MAP);
	this.markerManager = new GMarkerManager(this.map);
	//Marker information
	this.icon = new Array(this.numPlay);
	
	this.numIcon = new GIcon();
	this.numIcon.image = this.energyPic[0];
	this.numIcon.shadow = "../images/mm_20_shadow.png";
	this.numIcon.iconSize = new GSize(9, 12);
	this.numIcon.shadowSize = new GSize(0, 0);
	this.numIcon.iconAnchor = new GPoint(0, 0);
	this.numIcon.infoWindowAnchor = new GPoint(9, 2);
	//this.numIcon.infoShadowAnchor = new GLatLng(18, 25);
	
	this.baseIcon = new GIcon();
	this.baseIcon.image = this.gskirmImage;
	this.baseIcon.shadow = "../images/mm_20_shadow.png";
	this.baseIcon.iconSize = new GSize(20, 35);
	this.baseIcon.shadowSize = new GSize(25, 28);
	this.baseIcon.iconAnchor = new GPoint(8, 23);
	this.baseIcon.infoWindowAnchor = new GPoint(9, 2);
}

Gskirm.prototype.uiLoading = function()
{
	//Code needed for the starting icon, and game start menu, including tabbed infowindow
	this.baseIcon.iconSize = new GSize(35, 60);
	this.baseIcon.image = this.gskirmImage;
	var point = new GLatLng(0, 0); //Central starter
	// this below may or maynot be UI specific
	var htmla = "<div style=white-space:nowrap;>";
	htmla += "<form name=rando>";
	htmla += "Country Select- ";
	htmla += "<select name=asgn id=countrySelect>";
	htmla += "<option value=auto selected>Auto";
	htmla += "<option value=man>Manual";
	if (IsTutorial) 
	{
		htmla += "<option value=sample>Sample";
	}
	htmla += "</select><br/>";
	htmla += "Energy Deployment- ";
	htmla += "<select name=drop id=energyDeploy>";
	htmla += "<option value=min>Minimal";
	htmla += "<option value=man>Manual";
	htmla += "<option value=auto selected>AutoFill";
	if (IsTutorial) 
	{
		htmla += "<option value=sample>Sample";
	}
	htmla += "</select><br/>";
	htmla += "Total number of players<br/>";
	htmla += "2<input type=radio name='randNum' value=2>";
	htmla += " | 3<input type=radio name='randNum' value=3>";
	htmla += " | 4<input type=radio name='randNum' value=4 checked>";
	htmla += " | 5<input type=radio name='randNum' value=5>";
	htmla += " | 6<input type=radio name='randNum' value=6><br/>";
	htmla += "Neutral player <input type=checkbox name=neutralCheck><br/>";
	htmla += "Power Surge <input type=checkbox name=surgeCheck><br/>";
	//htmla += "Virtual Dice <input type=checkbox name=randDice checked=checked><br/>";
	htmla += "<input type=button value=Start onclick='GS.gameType()' id=StartGame />";
	htmla += "</form></div>";
	
	var htmlb = '<div>';
	htmlb += "<form name=load>";
	htmlb += "Load a saved game<br/>";
	//htmlb+= "<input type=file name=lfile id=lfile size='20'>";
	//htmlb+= "<br/><input type=button onclick='GS.loadgame()' value=Load>";
	htmlb += "<br/>Currently unavailable";
	htmlb += "</form>";
	htmlb += "<br/></div>";
	
	function createTabbedMarker(point, html1, html2, label1, label2, icon)
	{
		var marker = new GMarker(point, icon);
		GEvent.addListener(marker, "click", function()
		{
			marker.openInfoWindowTabsHtml([new GInfoWindowTab(label1, html1), new GInfoWindowTab(label2, html2)]);
		});
		return marker;
	}
	
	this.central = createTabbedMarker(point, htmla, htmlb, "NewGame", "Load", this.baseIcon);
	//End of tabbed marker creation
	this.map.addOverlay(this.central);
	this.triggerClick(this.central);
}

// These controls are inside the gmap and therefore are UI specific
//Turn controls holding in topright corner with pictures for the current turn
function turnControl(numPlay)
{
	this.players_ = numPlay;
}

turnControl.prototype = new GControl();
turnControl.prototype.initialize = function(map)
{
	var container = document.createElement("div");
	var toDiv = document.createElement("div");
	this.setButtonStyle_(toDiv);
	container.appendChild(toDiv);
	var turnImg = new Array(this.players_);
	for (var i = 0; i < this.players_; i++) 
	{
		turnImg[i] = document.createElement('img');
		if (GS.players[i].alive == 0) 
		{
			turnImg[i].src = "../images/guy-black.gif";
		}
		else 
		{
			turnImg[i].src = GS.players[i].mark;
		}
		turnImg[i].height = 35;
		turnImg[i].width = 20;
		turnImg[i].id = "turn" + i;
		toDiv.appendChild(turnImg[i]);
	}
	map.getContainer().appendChild(container);
	return container;
}

turnControl.prototype.getDefaultPosition = function()
{
	return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}

turnControl.prototype.setButtonStyle_ = function(button)
{
	button.style.textDecoration = "underline";
	button.style.color = "#0000cc";
	button.style.backgroundColor = "black";
	button.style.font = "small Arial";
	button.style.border = "1px solid black";
	button.style.padding = "2px";
	button.style.marginBottom = "3px";
	button.style.textAlign = "center";
	button.style.width = "2em";
	button.style.cursor = "pointer";
}


//Buttons for ending turn and moving on to energy transfer phase
function gameControl()
{
}

gameControl.prototype = new GControl();
// Creates a one DIV for each of the buttons and places them in a container
// DIV which is returned as our control element. We add the control to
// to the map container and return the element for the map class to
// position properly.
gameControl.prototype.initialize = function(map)
{
	var container = document.createElement("div");
	
	var combatDiv = document.createElement("div");
	this.setButtonStyle_(combatDiv);
	container.appendChild(combatDiv);
	var combatImg = document.createElement('img');
	combatImg.src = "../images/blast.jpg";
	combatImg.height = 25;
	combatImg.width = 25;
	combatImg.title = "Battle Phase";
	combatImg.id = "BattleImage";
	combatDiv.appendChild(combatImg);
	
	var transferDiv = document.createElement("div");
	this.setButtonStyle_(transferDiv);
	container.appendChild(transferDiv);
	var xfImg = document.createElement('img');
	xfImg.src = "../images/castle.png";
	xfImg.height = 25;
	xfImg.width = 25;
	xfImg.title = "Energy Transfer";
	xfImg.id = "TransferImage";
	transferDiv.appendChild(xfImg);
	GEvent.addDomListener(transferDiv, "click", function()
	{
		GS.freeMove();
	});
	
	var techingDiv = document.createElement("div");
	this.setButtonStyle_(techingDiv);
	container.appendChild(techingDiv);
	var techImg = document.createElement('img');
	techImg.src = "../images/bulb.png";
	techImg.height = 25;
	techImg.width = 25;
	techImg.title = "Technology";
	techImg.id = "TechImage";
	techingDiv.appendChild(techImg);
	GEvent.addDomListener(techingDiv, "click", function()
	{
		GS.techChoose();
	});
	
	var endTurnDiv = document.createElement("div");
	this.setButtonStyle_(endTurnDiv);
	container.appendChild(endTurnDiv);
	var endImg = document.createElement('img');
	endImg.src = "../images/next.png";
	endImg.height = 25;
	endImg.width = 25;
	endImg.title = "End Turn";
	endImg.id = "EndImage";
	endTurnDiv.appendChild(endImg);
	GEvent.addDomListener(endTurnDiv, "click", function()
	{
		GS.endturn();
	});
	
	map.getContainer().appendChild(container);
	return container;
}

// By default, the control will appear in the top left corner of the
// map with 7 pixels of padding.
gameControl.prototype.getDefaultPosition = function()
{
	return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
}

// Sets the proper CSS for the given button element.
gameControl.prototype.setButtonStyle_ = function(button)
{
	button.style.textDecoration = "underline";
	button.style.color = "#0000cc";
	button.style.backgroundColor = "white";
	button.style.font = "small Arial";
	button.style.border = "1px solid black";
	button.style.padding = "2px";
	button.style.marginBottom = "3px";
	button.style.textAlign = "center";
	button.style.width = "2em";
	button.style.cursor = "pointer";
}

//Turn controls holding in topright corner with pictures for the current turn
function battleScores()
{
}

battleScores.prototype = new GControl();
battleScores.prototype.initialize = function(map)
{
	var container = document.createElement("div");
	var atkDiv = document.createElement("div");
	var defDiv = document.createElement("div");
	var lossDiv = document.createElement("div");
	atkDiv.id = "atkBlock";
	defDiv.id = "defBlock";
	lossDiv.id = "lossBlock";
	atkDiv.appendChild(document.createTextNode("Attack Score"));
	defDiv.appendChild(document.createTextNode("Defend Score"));
	lossDiv.appendChild(document.createTextNode("Battle Loss"));
	this.setButtonStyle_(atkDiv);
	container.appendChild(atkDiv);
	this.setButtonStyle_(defDiv);
	container.appendChild(defDiv);
	this.setButtonStyle_(lossDiv);
	container.appendChild(lossDiv);
	map.getContainer().appendChild(container);
	return container;
}

battleScores.prototype.getDefaultPosition = function()
{
	return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(7, 7));
}

battleScores.prototype.setButtonStyle_ = function(button)
{
	button.style.backgroundColor = "white";
	button.style.font = "small Arial";
	button.style.border = "1px solid black";
	button.style.padding = "2px";
	button.style.marginBottom = "3px";
	button.style.textAlign = "center";
	button.style.width = "6em";
}

Gskirm.prototype.preloadImages = function()
{
	//log("preloadingImages");
	var i;
	var point;
	this.preloadRobot = new Array(this.numPlay);
	this.preloadObelisk = new Array(this.numPlay);
	var lat = 80;
	var lng = -100;
	point = new GLatLng(lat, lng);
	this.singleObelisk = this.simpleMarker(point, this.obelImage);
	this.map.addOverlay(this.singleObelisk);
	
	for (i = 0; i < this.numPlay; i++) 
	{
		// place robot and obelisk of each playing color
		lng += 10;
		point = new GLatLng(lat, lng);
		this.preloadRobot[i] = this.simpleMarker(point, this.players[i].mark);
		this.map.addOverlay(this.preloadRobot[i]);
		lng += 10;
		point = new GLatLng(lat, lng);
		this.preloadObelisk[i] = this.simpleMarker(point, this.players[i].obelMark);
		this.map.addOverlay(this.preloadObelisk[i]);
	}
	this.preloadEnergy = new Array(10);
	this.preloadCombat = new Array(10);
	lat = 20;
	lng = -100;
	for (i = 0; i < 10; i++) 
	{
		// place combat and energy digits on the field
		point = new GLatLng(lat, lng);
		this.preloadEnergy[i] = this.simpleEnergy(point, i);
		this.map.addOverlay(this.preloadEnergy[i]);
		this.preloadCombat[i] = this.simpleCombat(point, i);
		this.map.addOverlay(this.preloadCombat[i]);
		lng += 20;
	}
	this.isPreload = true;
}

Gskirm.prototype.clearStartIcon = function()
{
	if (this.central) 
	{
		this.central.remove();
	}
}

//A helper function for the strings of countries during manual assign phase
Gskirm.prototype.manMark = function(spot) // this.baseIcon should probably be an external function call
{
	var str = this.nations[spot].name;
	if (this.nations[spot].owned == -1) 
	{
		//str+= "(Free)"; todo: temporary title fix
		if (this.nations[spot].homeCont == this.obelCont) 
		{
			this.baseIcon.image = this.obelImage; //gskui
		}
		else 
		{
			this.baseIcon.image = this.blackImage;
		}
	}
	else 
	{
		//str+= "(Occupied)";
		if (this.nations[spot].homeCont == this.obelCont) 
		{
			this.baseIcon.image = this.players[this.nations[spot].owned].obelMark;
		}
		else 
		{
			this.baseIcon.image = this.players[this.nations[spot].owned].mark;
		}
	}
	
	this.baseIcon.iconSize = new GSize(20, 35);
	this.point = this.nations[spot].latLng;
	if (!this.allRegionsOwned) 
	{
		this.nations[spot].region = new GMarker(this.point, {
			icon: this.baseIcon,
			title: str
		});
	}
	else 
	{
		this.nations[spot].region.setImage(this.blackImage);
	}
	
	//gskui
	GEvent.addListener(this.nations[spot].region, "click", function()
	{
		if (GS.initial == 1) 
		{
			GS.manChoose(i);
		}
		else 
		{
			GS.region[spot].openInfoWindowHtml(GS.nationOptions(i));
		}
		GS.restamp();
	});
	this.map.addOverlay(this.nations[spot].region);
	this.unitCount(spot);
}

Gskirm.prototype.setClaimedRegionImage = function(nat)
{
	if (this.nations[nat].homeCont == this.numCont - 1) 
	{
		this.nations[nat].region.setImage(this.players[this.nations[nat].owned].obelMark);
	}
	else 
	{
		this.nations[nat].region.setImage(this.players[this.nations[nat].owned].mark);
	}
}

//The html used in info windows for claiming, may change this to a simple click to claim
Gskirm.prototype.claimText = function(land)
{
	//gskui
	var html = "<div style=white-space:nowrap;>" + this.nations[land].name + "<br/>";
	if (this.nations[land].owned == -1) 
	{
		html += "<input class=button type=button value=Claim onclick=GS.manClaim(" + land + ") >";
	}
	else 
	{
		html += "Sorry, this has already been claimed";
	}
	html += "</div>";
	return html;
}

Gskirm.prototype.defaultIconSize = function()
{
	this.baseIcon.iconSize = new GSize(20, 35);
}

/** 
 * Delete all those preloaded guys
 * @param {}
 * @return {}
 */
Gskirm.prototype.deletePreloaded = function()
{
	if (this.isPreload == false) 
	{
		return;
	}
	this.isPreload = false;
	var i;
	this.singleObelisk.remove();
	delete this.singleObelisk;
	
	for (i = 0; i < this.numPlay; i++) 
	{
		// place robot and obelisk of each playing color
		this.preloadRobot[i].remove();
		this.preloadObelisk[i].remove();
	}
	delete this.preloadRobot;
	delete this.preloadObelisk;
	
	for (i = 0; i < 10; i++) 
	{
		// place combat and energy digits on the field
		this.preloadEnergy[i].remove();
		this.preloadCombat[i].remove();
	}
	delete this.preloadEnergy;
	delete this.preloadCombat;
}

Gskirm.prototype.ChangeOverlayNormal = function(overlay)
{
	this.ChangeOverlay(overlay, 20, 35);
}

Gskirm.prototype.changeOverlay = function(overlay, x, y)
{
	// todo: constants for width/height of things that use this
	
	this.baseIcon.iconSize = new GSize(x, y);
	if (this.nations[overlay].homeCont == this.numCont - 1) 
	{
		if (this.nations[overlay].owned == -1) 
		{
			this.baseIcon.image = this.obelImage;
		}
		else 
		{
			this.baseIcon.image = this.players[this.nations[overlay].owned].obelMark;
		}
	}
	else 
	{
		this.baseIcon.image = this.players[this.nations[overlay].owned].mark;
	}
	
	if (this.allRegionsOwned) 
	{
		if (this.nations[overlay].homeCont == this.numCont - 1) 
		{
			if (this.nations[overlay].owned == -1) 
			{
				this.nations[overlay].region.setImage(this.obelImage);
			}
			else 
			{
				this.nations[overlay].region.setImage(this.players[this.nations[overlay].owned].obelMark);
			}
			// todo: title isn't changing here
			//this.nations[i].region.N.title = "("+this.nations[i].energy+")"+this.nations[i].name+"|"+this.nations[i].combat+"|";
		}
		else 
		{
			this.nations[overlay].region.setImage(this.players[this.nations[overlay].owned].mark);
			//this.nations[i].region.N.title = "("+this.nations[i].energy+")"+this.nations[i].name+"|"+this.nations[i].combat+"|";
		}
	}
	else 
	{
		var point = this.nations[overlay].latLng;
		this.nations[overlay].region = this.createMarker(point, overlay);
		this.map.addOverlay(this.nations[overlay].region);
		//Have spots here for troop images
	}
	this.unitCount(overlay);
}

Gskirm.prototype.getNumPlayers = function()
{
	for (var i = 0; i < 5; i++) 
	{
		if (document.rando.randNum[i].checked) 
		{
			return document.rando.randNum[i].value;
		}
	}
}

Gskirm.prototype.getPowerSurge = function()
{
    return document.rando.surgeCheck.checked;
}

Gskirm.prototype.getPhaseImages = function(str)
{
	return document.getElementById(str);
}

Gskirm.prototype.getTroopPlaceValue = function()
{
	return parseInt(document.force.drop.value);
}

Gskirm.prototype.setTroopPlaceValue = function(value)
{
	document.force.drop.value = value;
}

Gskirm.prototype.getAttackMovingValue = function()
{
	return parseInt(document.attack.movin.value);
}

Gskirm.prototype.setAttackMovingValue = function(value)
{
	document.attack.movin.value = value;
}

Gskirm.prototype.getAttackAggroValue = function()
{
	return parseInt(document.attack.aggro.value);
}

Gskirm.prototype.setAttackAggroValue = function(value)
{
	document.attack.aggro.value = value;
}

Gskirm.prototype.getTypeDropValue = function()
{
	return document.rando.drop.value;
}

Gskirm.prototype.getTypeAssignValue = function()
{
	return document.rando.asgn.value;
}

Gskirm.prototype.getNeutralPlayer = function()
{
	return document.rando.neutralCheck.checked;
}

Gskirm.prototype.getVirtualDice = function()
{
	return document.rando.randDice.checked;
}

Gskirm.prototype.setAttackersDice = function(atkScore, atkSides, atkDice)
{
	var max;
	var score = Math.floor(atkScore);
	var printMax;
	max = this.realDiceMax(atkDice*1.0, atkSides*1.0) * atkDice;
	printMax = Math.floor(max);
	if (atkScore != score)
	{
		score = score + "+";
	}
	if (max != printMax)
	{
		printMax = printMax + "+";
	}
	document.getElementById('atkBlock').firstChild.data = "atk " + score + "/ " + printMax;
}

Gskirm.prototype.setDefendersDice = function(defScore,defSides,defDice)
{
	var max;
	var score = Math.floor(defScore);
	var printMax;
	max = this.realDiceMax(defDice*1.0, defSides*1.0) * defDice;
	printMax = Math.floor(max);
	if (defScore != score)
	{
		score = score + "+";
	}
	if (max != printMax)
	{
		printMax = printMax + "+";
	}	
	document.getElementById('defBlock').firstChild.data = "def " + score + "/ " + printMax;
}

Gskirm.prototype.setResultField = function(atkLoss,defLoss)
{
	document.getElementById('lossBlock').firstChild.data = atkLoss + ":A --- D:" + defLoss;
}

Gskirm.prototype.gamePhaseColoring = function()
{
	// change border color too?
	// todo: next turn isn't changing, will figure somethin out
	if (this.gamePhase == 2) // Battle Phase
	{
		// turn battle bg white, turn rest blue
		this.gamePhaseImages[0].style.backgroundColor = "white";
		this.gamePhaseImages[1].style.backgroundColor = "blue";
		this.gamePhaseImages[2].style.backgroundColor = "blue";
		this.gamePhaseImages[3].style.backgroundColor = "blue";
		this.activeTurnColor('turn' + this.gameTurn, "white");
	}
	else if (this.gamePhase == 3) // Energy transfer
	{
		// turn battle bg black, transfer white, rest blue
		this.gamePhaseImages[0].style.backgroundColor = "black";
		this.gamePhaseImages[1].style.backgroundColor = "white";
		this.gamePhaseImages[2].style.backgroundColor = "blue";
		this.gamePhaseImages[3].style.backgroundColor = "blue";
	}
	else if (this.gamePhase == 4) // Tech
	{
		// turn battle/transfer black, tech white, endturn blue
		this.gamePhaseImages[0].style.backgroundColor = "black";
		this.gamePhaseImages[1].style.backgroundColor = "black";
		this.gamePhaseImages[2].style.backgroundColor = "white";
		this.gamePhaseImages[3].style.backgroundColor = "blue";
	}
}

//Some pretty function that makes the border the coloring of the player who's turn it is
Gskirm.prototype.boardColoring = function()
{
	var c = this.players[this.gameTurn].color;
	document.getElementById('map').style.border = '3px dashed ' + c; // gskui
}

Gskirm.prototype.activeTurnColor = function(activeTurn, color)
{
	document.getElementById(activeTurn).style.backgroundColor = color;
}

Gskirm.prototype.closeInfoBubble = function()
{
	this.map.closeInfoWindow();
}

Gskirm.prototype.panToFixed = function()
{
	this.map.panTo(new GLatLng(40, 10)); //panMap	
}

Gskirm.prototype.setCombatImage = function(i,val)
{
	this.nations[i].regionCombat.setImage(this.combatPic[val]);
}

Gskirm.prototype.setEnergyImage = function(i,val)
{
	this.nations[i].regionEnergy.setImage(this.energyPic[val]);	
}

Gskirm.prototype.makeCombatEnergyMarkers = function(i)
{
	var point = this.nations[i].latLng;
	this.nations[i].regionCombat = this.combatMarker(point, i);
	this.map.addOverlay(this.nations[i].regionCombat);
	this.nations[i].regionEnergy = this.energyMarker(point, i);
	this.map.addOverlay(this.nations[i].regionEnergy);
}

Gskirm.prototype.uiRun = function()
{
	this.map.addControl(new turnControl(this.numPlay)); // gskui
	if (this.neutralPlayer != -1) 
	{
		this.players[this.neutralPlayer].place = "NEUTRAL";
		this.activeTurnColor('turn' + this.neutralPlayer, "gray");
	}
}

Gskirm.prototype.uiNewGame = function()
{
	this.map.removeOverlay(this.over);
	this.baseIcon.image = this.gskirmImage;
	this.baseIcon.iconSize = new GSize(35, 60);
	this.map.addOverlay(this.central);
	this.triggerClick(this.central);
}

Gskirm.prototype.uiGameOver = function()
{
	//gskui
	this.baseIcon.iconSize = new GSize(35, 60);
	this.baseIcon.image = this.gskirmImage;
	point = new GLatLng(0, 0); //Central
	this.over = new GMarker(point, this.baseIcon);
	var html = "<div style=white-space:nowrap;>"
	html += "Player " + (this.winningPlayer + 1) + " is the winnar<br />";
	html += "<a href='javascript:GS.newGame()'>Restart</a>";
	html += "</div>";
	GEvent.addListener(this.over, "click", function()
	{
		GS.over.openInfoWindowHtml(html);
	});
	this.map.addOverlay(this.over);
	
	this.panToFixed();
	setTimeout(function()
	{
		GS.triggerClick(GS.over);
	}, 500);
}

Gskirm.prototype.uiMakeMarkers = function()
{
	for (i = 0; i < this.numCountry; i++) 
	{
		this.changeOverlay(i, 20, 35);
	}

	this.baseIcon.iconSize = new GSize(35, 60);
	this.baseIcon.image = this.gskirmImage;
	var point = new GLatLng(55, -43); //gskirm card
	if (!this.allRegionsOwned) 
	{
		this.gskirmIcon = new GMarker(point, {
			icon: this.baseIcon
		});
		this.map.addOverlay(this.gskirmIcon);
	}
}

//Outside trigger function, needs a better name
Gskirm.prototype.triggerClick = function(spot)
{
	// gskui
	this.closeInfoBubble();
	GEvent.trigger(spot, "click");
}

//Points will be translated into AJAX
//makeMarkers will change massively once this occurs
Gskirm.prototype.createMarker = function(point, num)
{
	var str = this.nations[num].name; // todo: title temp fix
	var marker = new GMarker(point, {
		icon: this.baseIcon,
		title: str
	});
	GEvent.addListener(marker, "click", function()
	{
		if (GS.initial != 1) 
		{
			marker.openInfoWindowHtml(GS.nationOptions(num));
		}
		else 
		{
			GS.place1(num);
		}
	});
	return marker;
}

Gskirm.prototype.simpleMarker = function(point, image)
{
	this.baseIcon.image = image;
	this.baseIcon.iconSize = new GSize(20, 35);
	var marker = new GMarker(point, {
		icon: this.baseIcon
	});
	return marker;
}

Gskirm.prototype.simpleEnergy = function(point, value)
{
	var energyIcon = new GIcon(this.numIcon);
	energyIcon.image = this.energyPic[value];
	energyIcon.iconAnchor = new GPoint(9, 0); // testing points, orig 0,0
	var marker = new GMarker(point, {
		icon: energyIcon
	});
	return marker;
}

//For a combat marker
Gskirm.prototype.simpleCombat = function(point, value)
{
	var combatIcon = new GIcon(this.numIcon);
	combatIcon.image = this.combatPic[value];
	combatIcon.iconAnchor = new GPoint(0, 0); // testing points orig 9,0
	var marker = new GMarker(point, {
		icon: combatIcon
	});
	return marker;
}

//For a energy digit
Gskirm.prototype.energyMarker = function(point, num)
{
	var val = 0;
	if (this.nations[num].energy > this.maxEnergy) // pretty sure energy will max out at 9
	{
		val = this.maxEnergy;
	}
	else 
	{
		val = this.nations[num].energy;
	}
	var str = this.nations[num].name; // todo: temp title fix
	var energyIcon = new GIcon(this.numIcon);
	energyIcon.image = this.energyPic[val];
	energyIcon.iconAnchor = new GPoint(9, 0); // orig 0,0
	var marker = new GMarker(point, {
		icon: energyIcon,
		title: str
	});
	GEvent.addListener(marker, "click", function()
	{
		GS.triggerClick(num);
	});
	return marker;
}

//For a combat marker
Gskirm.prototype.combatMarker = function(point, num)
{
	//gskui
	var val = 0;
	if (this.nations[num].combat > this.maxCombat) 
	{
		val = this.maxCombat;
	}
	else 
	{
		val = this.nations[num].combat;
	}
	var combatIcon = new GIcon(this.numIcon);
	combatIcon.image = this.combatPic[val];
	combatIcon.iconAnchor = new GPoint(0, 0); //0,0
	var str = this.nations[num].name; // todo: temp title fix
	var marker = new GMarker(point, {
		icon: combatIcon,
		title: str
	});
	GEvent.addListener(marker, "click", function()
	{
		GS.triggerClick(GS.nations[num].region);
	});
	return marker;
}

Gskirm.prototype.drawBorders = function()
{
	var i, j, line, neigh;
	for (i = 0; i < this.numCountry; i++) 
	{
		for (j = 0; j < 6; j++) 
		{
			neigh = this.nations[i].neighbors[j];
			if (neigh != -1 && neigh > i) 
			{
				//gskui
				line = this.polyHelper(this.nations[i].latLng, this.nations[neigh].latLng, i, neigh);
				//add cont color thing here
				
				this.map.addOverlay(line);
			}
		}
	}
}

Gskirm.prototype.polyHelper = function(start, end, a, b)
{
	var col = "#000000";
	if (this.nations[a].homeCont == this.nations[b].homeCont) 
	{
		col = this.cont[this.nations[a].homeCont].color;
	}
	var line = new GPolyline([start, end], col, 3, .7);
	return line;
}

function log(str)
{
	if (logLevel) // when things are working better, change to enum
	{
		GLog.write(str);
	}
}

