var sQueryResults, iTotalQueryResults = 0, iTotalFields, iMapWidthDown, iMapWidthUp, iMapHeightDown, 
	iMapHeightUp, bNewRefImage = true, LegRows = new Array(), mapxml_file, mapxml, sModifiers = "none", 
	sOldImg = "", bCloseFooter = false;

var theopener = window.opener;
if (theopener != null)
{
	mapxml_file = theopener.XMLFile;
	Imap = theopener.Imap;
	Imode = theopener.Imode;
	Iextent = theopener.Iextent;
	Ipoint = theopener.Ipoint;
	Iscale = theopener.Iscale;
	Iqstr = theopener.Iqstr;
	Iqlayer = theopener.Iqlayer;
	Iqfield = theopener.Iqfield;
}

window.name = "GISMaps";
if (mapxml_file == null) mapxml_file = "bin/xml/mapserv.xml";

function LoadMapservXML()
{
	// IE
	if (window.ActiveXObject)
	{
		mapxml = new ActiveXObject("Microsoft.XMLDOM");
		mapxml.async = false;
		mapxml.load(mapxml_file);
		LoadInfo();
	}
	// non-IE browsers
	else
	{
		//mapxml = document.implementation.createDocument("", "", null);
		//mapxml.load(mapxml_file);
		//mapxml.onload = LoadInfo;
		var xmlhttp = new window.XMLHttpRequest();
		xmlhttp.open("GET",mapxml_file,false);
		xmlhttp.send(null);
		mapxml = xmlhttp.responseXML.documentElement;
		LoadInfo();
	}
}

function LoadInfo() { infoframe.location = "bin/html/info.htm"; }


function MouseDown()
{
	iMapWidthDown = frames["mapframe"].document.body.clientWidth;
	iMapHeightDown = frames["mapframe"].document.body.clientHeight;
}

function MouseUp()
{
	iMapWidthUp = frames["mapframe"].document.body.clientWidth;
	iMapHeightUp = frames["mapframe"].document.body.clientHeight;
	
	if (iMapWidthUp != iMapWidthDown || iMapHeightUp != iMapHeightDown) top.frames["infoframe"].Submit_Refresh();
}

function OnLoad()
{
	//if (!window.ActiveXObject)
	if (navigator.appName == "Netscape")
	{
		document.location = "http://www.co.linn.or.us/webmap/ELLAMaps1.0_ff/run.htm";
		return;
	}
	RegisterEvents();
	LoadMapservXML();
}

function RegisterEvents()
{
	var element = document.getElementById("topframeset");
	element.onmousedown = MouseDown;
	element.onmouseup = MouseUp;
}