var wdwLandscape = null;

function RequestKey(strKey, strDescript)
{
	if (typeof(strKey) == 'undefined')
		return false;
		
	if (typeof(strDescript) == 'undefined')
		strDescript = "";
			
	if (strDescript != "")
		strDescript = "&descript=" + strDescript;
			
	if (IsWindowOpen(wdwLandscape))
	{
		wdwLandscape.location.href = "/OnlineMapping/Landscape/Map.asp?name=macedon&key=" + strKey + strDescript
		wdwLandscape.focus()
	}
	else
	{
		wdwLandscape = window.open("/OnlineMapping/Landscape/Map.asp?name=macedon&key=" + strKey + strDescript,"Landscape",GetOpenWinStr(440,605) + "screenX=1,screenY=1,top=1,left=1,statusbar=no,menubar=no,location=no,toolbar=no");
	}
	
	return false;
}

function GetOpenWinStr(intWidth, intHeight)
{   // Returns a string that can be used in a window.open statement.
  // Returns the smaller of either requested width and height or actual screen width and height
  // If requested dimensions are larger than screen dimensions scrollbars are also enabled.
		      
	var intScreenWidth = window.screen.width;
	var intScreenHeight = window.screen.height - 70;
	var blnScrollbars = 0;
	
	// Get the smaller of the screen width or requested width
	var intReturnWidth = (intWidth > intScreenWidth) ? intScreenWidth : intWidth;
	// Get the smaller of the screen height or requested height
	var intReturnHeight = (intHeight > intScreenHeight) ? intScreenHeight: intHeight;

	// Do we need scrollbars?
	blnScrollbars = (intReturnWidth != intWidth) || (intReturnHeight != intHeight) ? 1 : 0;
	
	return "width=" + intReturnWidth + ",height=" + intReturnHeight + ",scrollbars=" + blnScrollbars + ",";
}


function IsWindowOpen(wdw)
{
	if (wdw == null)
		return false;
	
	if (!wdw.open)
		return false;
		
	if (wdw.closed)
		return false;
	
	return true;
}

