﻿/////////////////////////
//
function delaySearch(strValue)
{
	if (strValue == 'True')
	{
		parent.layerFrame.document.getElementById('SearchDropDownList').style.visibility = "hidden";
	}
}


/////////////////////////
//
function UpdateMain(XYValue)
{
	if (XYValue.length > 0)
	{
		parent.mainFrame.document.getElementById('txtSearch').value = 'doNotUpdate';
		parent.mainFrame.document.getElementById('Form1').submit();

	}
}

/////////////////////////
//
function checkInput(e)
{
	if (e.value == 'Adress')
	{
		e.value = '';
	}
	if (e.value == 'Ort')
	{
		e.value = '';
	}
}

/////////////////////////
// Dölj element
function showId(id)
{
	document.getElementById(id).style.visibility = "visible";
}

/////////////////////////
//
function showParentId(id)
{
	parent.mainFrame.document.getElementById(id).style.visibility = "visible";
}

/////////////////////////
// Show element
function hideParentId(id)
{
	if (parent.mainFrame.document.getElementById(id))
	{
		parent.mainFrame.document.getElementById(id).style.visibility = "hidden";
	}
}

/////////////////////////
//Hide the supplied object id
function hideId(id)
{
	try
	{
		document.getElementById(id).style.visibility = "hidden";
	}
	catch (err)
	{
		//Don't catch, error occures when tool is clicked before page is loaded.
	}
}

/////////////////////////
//
function setInnerHtml(id, text)
{
	if (document.getElementById(id).innerHTML == '')
	{
		document.getElementById(id).innerHTML = text;
	}
	else
	{
		document.getElementById(id).innerHTML = '';
	}
}

/////////////////////////
//
function goToPrint(w, h)
{
	window.open('printSettings.aspx', "external", "width=" + w + ",height=" + h + ",resizable=yes,scrollbars=yes,status=no,location=no,toolbar=no,menubar=no").focus();
}

/////////////////////////
//
function goToMail()
{
	window.open('mail.aspx', "external", "width=300,height=320,resizable=yes,scrollbars=no,status=no,location=no,toolbar=no,menubar=no").focus();
}

/////////////////////////
//
//function goToKabelanvisning()
//{
//	window.open('custom/ka_prewindow.aspx', "external", "width=500,height=200,resizable=yes,scrollbars=yes,status=no,location=no,toolbar=no,menubar=no").focus();
//}

/////////////////////////
// Set application in write mode, write tools visible
function setWriteMode()
{
	showId('writeToolsDropDownList');
	showId('myCanvas');
	showId('myCanvasTemp');
	showId('mapCover');
	if (document.getElementById('writeToolsDropDownList').value == 'Text')
	{
		showId("textIKarta");
	}
}

/////////////////////////
// Set application in calc distance mode.
function setCalcDistanceMode()
{
	showId('mapCover');
	showId('myCanvasTemp');
	showId('myCanvas');

}

/////////////////////////
// Set application in view mode
function setUnWriteMode()
{
	document.getElementById('writeToolsDropDownList').value = 'Linje';
	totalDist = 0;
	hideId('writeToolsDropDownList');
	hideId('myCanvas');
	hideId('myCanvasTemp');
	hideId('mapCover');
	hideId('stracka');
	clearWrite();
}

