﻿var opacity = .8;
var falling = true;

function resizeMap()
{
	var height = document.getElementById("content").offsetHeight - document.getElementById("largeBox").offsetHeight;

	/*height -= cssPixelToInt(document.getElementById("mapContainer").style.paddingTop);
	height -= cssPixelToInt(document.getElementById("mapContainer").style.paddingBottom);*/
	var IE6 = (navigator.userAgent.toLowerCase().indexOf('msie 6') != -1) && (navigator.userAgent.toLowerCase().indexOf('msie 7') == -1);

	if (!IE6)
		height -= 46;
	else
		height -= 55;
	
	
	document.getElementById("mapContainer").style.height = "" + height + "px";

	if (map)
	{
		var center = map.getCenter();
		map.checkResize();
		map.setCenter(center);
	}
}

function cssPixelToInt(value)
{
	return parseInt(value.substr(0, value.length - 2));
}


function flashMoas()
{
	if (falling)
	{
		opacity -= 0.05;
		
		if (opacity < 0.3)
		{
			opacity = 0.3;
			falling = false;
		}			
	}
	else
	{
		opacity += 0.05;
		
		if (opacity >= .8)
		{
			opacity = .8;
			falling = true;
		}
	}

	/*
	var flashMoas = false;
	var flashSuas = false;
	
	for (var i = 0; i < moa_markers.length; i++)
	{
		if (document.getElementById("chkMOAs").checked)
		{
			if (moa_markers[i].sua.airspaceStatus == 1)
			{
				moa_markers[i].setFillStyle({ color: moa_markers[i].sua.fillcolor, weight: 1, opacity: opacity });
			}
			
			flashMoas = true;
		}
		else
			flashMoas = false;
	}

	
	for (var i = 0; i < sua_markers.length; i++)
	{
		if (document.getElementById("chkSUAs").checked)
		{
			if (sua_markers[i].sua.airspaceStatus == 1)
			{
				sua_markers[i].setFillStyle({ color: sua_markers[i].sua.fillcolor, weight: 1, opacity: opacity });
			}

			flashSuas = true;
		}
		else
			flashSuas = false;
	}

	if (flashSuas || flashMoas)
	{
		setTimeout("flashMoas()", 50);
	}
	else
	{
		opacity = 1.0;
		falling = true;
	}
	*/
}

