var drag=false;
var lastX=0;
var lastY=0;
var objTool;

function beginDrag(evt, tool)
{
	drag=true
	objTool = tool
	evt = (evt) ? evt : (window.event) ? window.event : ""
	if (evt)
	{
		lastX = evt.screenX
		lastY = evt.screenY
	}
}

function stopDrag()
{
	drag=false;
}

function moveDrag(evt)
{
	if (drag)
	{
		evt = (evt) ? evt : (window.event) ? window.event : ""
		ptX=evt.screenX
		ptY=evt.screenY
		if(document.all)
		{
			eval('document.all.'+objTool+'.style.left='+(parseInt(eval("document.all."+objTool+".style.left"))+ptX-lastX))
			eval('document.all.'+objTool+'.style.top='+(parseInt(eval("document.all."+objTool+".style.top"))+ptY-lastY))
			evt.returnValue=false
		}
		else if (document.getElementById)
		{
			elem=eval('document.getElementById("'+objTool+'")')
			eval('elem.style.left ='+(parseInt(eval("elem.style.left"))+ptX-lastX))
			eval('elem.style.top ='+(parseInt(eval("elem.style.top"))+ptY-lastY))
		}
		else if (document.layers)
		{
			elem = eval('document.'+objTool)
			elem.left=(parseInt(elem.left))+ptX-lastX
			elem.top=(parseInt(elem.top))+ptY-lastY
		}
		lastX = ptX
		lastY = ptY
	}
}

function getMapURL(strTile)
{
	//  Get the legend coordinates
	if(document.all)
	{
		if (document.all.legend)
		{
			legendX=document.all.legend.style.left
			legendY=document.all.legend.style.top
		}
	}
	else if (document.getElementById)
	{
		if (document.getElementById('legend'))
		{
			legendX=document.getElementById('legend').style.left
			legendY=document.getElementById('legend').style.top
		}
	}
	else if (document.layers)
	{
		if (document.legend)
		{
			legendX=document.legend.left
			legendY=document.legend.top
		}
	}

	strURL=strRegion+'Map.html?tile='+strTile
	if (selectPhoto!=null)
		strURL=strURL+'&photo='+selectPhoto
	if (selectCulvert!=null)
		strURL=strURL+'&culvert='+selectCulvert
	if (selectInstream!=null)
		strURL=strURL+'&instream='+selectInstream
	if (selectFish!=null)
		strURL=strURL+'&fish='+selectFish
	if (selectBulkhead!=null)
		strURL=strURL+'&bulkhead='+selectBulkhead
	if (selectWithdrawal!=null)
		strURL=strURL+'&withdrawal='+selectWithdrawal
	if (selectSedsrc!=null)
		strURL=strURL+'&sedsrc='+selectSedsrc
	if (selectAerial!=null)
		strURL=strURL+'&aerial='+selectAerial
	if (selectMouth!=null)
		strURL=strURL+'&mouth='+selectMouth
	if (locateFlag!=null)
		strURL=strURL+'&locate='+locateFlag
	if (legendFlag!=null)
		strURL=strURL+'&legend='+legendFlag
	if (pointsFlag!=null)
		strURL=strURL+'&points='+pointsFlag
	if (legendX!=null)
		strURL=strURL+'&legendX='+legendX
	if (legendY!=null)
		strURL=strURL+'&legendY='+legendY
		
	location.href=strURL
}

function getPhotoURL(strLmk,tile)
{
	location.href=strLmk
}

function getMouthURL(strLmk,tile)
{
	location.href="VashonLmk.html?mouth="+strLmk+"&tile="+tile
}

function getHomeURL()
{
	location.href="VashonTitle.html"
}

