//
//	Copyright 2001 Kingswood MapMechanics
//	Creation date:	27th July 2001
//	FileName:		chk.js
//	Written By:		Dannie Bye(Kingswood MapMechanics)
//	Customer:		Cook Hammond & Kell
//
//	Purpose:		Centralised JavaScript routines, opens windows, and parses values back and
//					forth between the browser
//	History
//	-------
//
//
//=============================================================================================
function changeTab ( objSelection )
{
	ChkApplet.setTab (objSelection);
}

//=============================================================================================
//called when user selects an item from the selection box
function updatePosition ( objSelection ){
	ChkApplet.setSavedPosition ( objSelection.value );
}
//=============================================================================================
function updateHashPosition(){
	document.ChkApplet.openHashPositionsDialog ();
}

//=============================================================================================
// Opens "geocoder.html" into a floating window
function openGazeteer()
{
	window_handle = window.open("geoCoder.html","","width=660,height=220,directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
}
//=============================================================================================
// Opens ASP and sends delimited value of HTML page names
function displayObjectsUnderClick ( strArrayOfObjects )
{
	var	strURL	="";
	//alert ( "Here" + strArrayOfObjects );
	arrArrayOfResults	=	strArrayOfObjects.split (";");
	strURL	+=	"<TABLE>";
	for (intCount=0;intCount < (arrArrayOfResults.length - 1);intCount++)
	{
		arrTmpArray	=	arrArrayOfResults[intCount].split ("-");
		//if (arrTmpArray.length = 1)
			strURL	+=	"<TR><TD VALIGH=TOP><LI><FONT CLASS=\'popupText\'><A HREF=\'" + arrTmpArray[1] + "\' TARGET=_Blank>" + arrTmpArray[0] + "</A></FONT></LI></TD></TR>";

	}
	strURL	+=	"</TABLE>";
	//alert (strURL);
	return overlib(strURL, TIMEOUT, 240000, WIDTH, 200, HEIGHT, 150, FIXX, 550, FIXY, 389, PADX, 10, 10, PADY, 10, 10  ) 
}
//=============================================================================================
function populateGeocodingOption ()
{
	if ( strSearchString.value == "" )
		alert ( "No Entry in text string ");
	else
	{
		strResults = ChkApplet.findMatchingGazName ( strSearchString.value )+"";;
		//alert ( strResults );
		var myArray = strResults.split(';');
		optSelect.length = 0; // clear the previous selections (make size of combo box 0)
		for ( intOptionNumber=0;intOptionNumber < ( myArray.length - 1);intOptionNumber++ )
		{
			optOption = new Option();
			optOption.text = myArray[intOptionNumber];
			optSelect.add ( optOption, 1 );
		}
	}
}
//=============================================================================================
function gotoPos( strSelectedOption )
{
	ChkApplet.setGazPos ( strSelectedOption );
}
//=============================================================================================
function changeScale ( strCurrentScale )
{
	//scale.value = strCurrentScale;
}
//=============================================================================================
function winUpdated()
{
	miniMap();
}
