
function makeCanvas() {
	drawFoW();
}

function drawFoW() {

	var start = new Date().getTime();
	
	var strFow = '';
	
	//Los quality
	var boxSize = 99;

	var bolWrite = true;


	for(x=0;x<mapSize*2;x+=boxSize)  {
		for(y=0;y<mapSize*2;y+=boxSize)  {
			bolWrite = true
			for(i=0;i<cities.length;i++) {
				if(cities[i][9] == intUserKingdomID || cities[i][13] == userID) {
					if(Math.sqrt(((cities[i][4] - -mapSize) - x) * ((cities[i][4] - -mapSize) - x) + ((cities[i][5] - -mapSize) - y) * ((cities[i][5] - -mapSize) - y)) <= (cityLOS - -cities[i][12])) {
						bolWrite = false;
						break;
					}
				}
			}
			if(bolWrite==true) {
				for(i=0;i<armies.length;i++) {
					if(armies[i][7] == intUserKingdomID || armies[i][11] == userID) {
						if(Math.sqrt(((armies[i][2] - -mapSize) - x) * ((armies[i][2] - -mapSize) - x) + ((armies[i][3] - -mapSize) - y) * ((armies[i][3] - -mapSize) - y)) <= armyLOS) {
							bolWrite = false;
							break;
						}
					}
				}
			}

			if(bolWrite==true) strFow += '<div onmousedown="bScroll=true;" onmouseup="bScroll=false;" class="fow" style="top: ' + (y - boxSize / 2) + '; left: ' + (x - boxSize / 2) + '; width: ' + boxSize + '; height: ' + boxSize + ';">Z</div>';
		}
	}

	document.getElementById('fow').innerHTML = strFow;
	
	var duration = new Date().getTime() - start;
	
	//alert(duration);
}

