function ReturnLatitude(textbox)
	{
	var strLat = new String(textbox.value);
	var strLat = new String(textbox.value);
	var Hemisphere = 1;
	var DecimalDeg = 0;
	var Degrees = 0;
	var Minutes = 0;
	var Seconds = 0;
	strLat = strLat.toUpperCase(); // Check for Alpha Char for N or S
	// Trim the string!
	//Match spaces at beginning and end of text and replace
	//with null strings
	//'/' begins and ends a regular expession
	//'^' Tells us to start at the beginning
	//'\s' is the escape for white space
	//'+' adds continuously such as "ssss" would gather all s'
	//'$' begins at the right and works backwards
	strLat = strLat.replace(/^\s+/,'').replace(/\s+$/,'');
	if(strLat.indexOf("S") != -1) // Set for southern Latitudes.
	{ // replace "S" with "" to clear the alpha Char and set Hemi to Neg.
		strLat = strLat.replace("S", "");
		Hemisphere = -1;
	}
	if(strLat.indexOf("-") == 0) // check for neg char for Souther Hemisphere
	{
		strLat = strLat.replace("-", "");
		Hemisphere = -1;
	}
	if(strLat.indexOf('N') != -1) // Clear any "n" values from the Latitude.
	{
		strLat = strLat.replace('N', '');
		Hemisphere = 1;
	}
	// Trim the string again!
	strLat = strLat.replace(/^\s+/,'').replace(/\s+$/,'');
	// Make sure the user didn't use a '-' char to separate numbers.
	// If they did, replace the "-" with white spaces " " for .Split to work.
	strLat = strLat.replace("-", " ");
	// ==============================================
	var Array1 = strLat.split(" ");
	if(Array1.length > 3 || Array1.length == 0) // split the char - if there are more than 3 sets, set to nothing.
	{
		window.alert("Latitude not valid, could not interpret.");
		textbox.value = "";
		return false;
	}
	if(Array1.length == 1) // decimal notation already
	{
		DecimalDeg = parseFloat(Array1[0].toString());
		if(isNaN(DecimalDeg))
		{
			window.alert("Can not interpret the latitude.");
			textbox.value = "";
			return false;
		}		
		if(DecimalDeg > 90)
		{
			window.alert("Latitude can not exceed 90 degrees.");
			textbox.value = "";
			return false;
		}
		Degrees = Math.floor(DecimalDeg);
		Minutes = (DecimalDeg - Degrees) * 60;
		Seconds = (Minutes - Math.floor(Minutes)) * 60;
		if(Hemisphere == 1)
		{
			textbox.value = Format2Zeros(Degrees) + " " + Format2Zeros(Math.floor(Minutes)) + " " + Format2Zeros2Decimals(Seconds) + " N";
		}
		else
		{
			textbox.value = Format2Zeros(Degrees) + " " + Format2Zeros(Math.floor(Minutes)) + " " + Format2Zeros2Decimals(Seconds) + " S";
		}			
		return true;
	}
	if(Array1.length == 2) // degrees minutes - decimal minutes.
	{
		DecimalDeg = parseFloat(Array1[0].toString());
		if(isNaN(DecimalDeg))
		{
			window.alert("Can not interpret the latitude.");
			textbox.value = "";
			return false;
		}		
		if(DecimalDeg > 90)
		{
			window.alert("Latitude can not exceed 90 degrees.");
			textbox.value = "";
			return false;
		}
		Degrees = Math.floor(DecimalDeg);
		Minutes = parseFloat(Array1[1].toString());
		if(isNaN(Minutes))
		{
			window.alert("Can not interpret the latitude.");
			textbox.value = "";
			return false;
		}		
		if(Minutes > 59)
		{
			window.alert("Latitude minutes can not exceed 59.");
			textbox.value = "";
			return false;
		}
		Seconds = (Minutes - Math.floor(Minutes)) * 60;
		if(Hemisphere == 1){
			textbox.value = Format2Zeros(Degrees) + " " + Format2Zeros(Math.floor(Minutes)) + " " + Format2Zeros2Decimals(Seconds) + " N";
		}
		else //display south for - hemispheres
		{
			textbox.value = Format2Zeros(Degrees) + " " + Format2Zeros(Math.floor(Minutes)) + " " + Format2Zeros2Decimals(Seconds) + " S";
		}			
		return true;
	}
	if(Array1.length == 3) // degrees minutes and seconds.
	{
		Degrees = Math.floor(Array1[0].toString());
		if(isNaN(DecimalDeg))
		{
			window.alert("Can not interpret the latitude.");
			textbox.value = "";
			return false;
		}		
		if(DecimalDeg > 90)
		{
			window.alert("Latitude can not exceed 90 degrees.");
			textbox.value = "";
			return false;
		}
		Minutes = Math.floor(Array1[1].toString());
		if(isNaN(Minutes))
		{
			window.alert("Can not interpret the latitude.");
			textbox.value = "";
			return false;
		}		
		if(Minutes > 59)
		{
			window.alert("Latitude minutes can not exceed 59.");
			textbox.value = "";
			return false;
		}
		Seconds = parseFloat(Array1[2].toString());
		if(isNaN(Seconds))
		{
			window.alert("Can not interpret the latitude.");
			textbox.value = "";
			return false;
		}		
		if(Seconds > 59.99)
		{
			window.alert("Latitude seconds can not exceed 59.99.");
			textbox.value = "";
			return false;
		}
		if(Hemisphere == 1){
			textbox.value = Format2Zeros(Degrees) + " " + Format2Zeros(Minutes) + " " + Format2Zeros2Decimals(Seconds) + " N";
		}
		else//display south for - hemispheres
		{
			textbox.value = Format2Zeros(Degrees) + " " + Format2Zeros(Minutes) + " " + Format2Zeros2Decimals(Seconds) + " S";
		}		
		return true;
	}
}
function ReturnLongitude(textbox)
{
	var strLon = new String(textbox.value);
	var Hemisphere = 1;
	var DecimalDeg = 0;
	var Degrees = 0;
	var Minutes = 0;
	var Seconds = 0;
	strLon = strLon.toUpperCase(); // Check for Alpha Char for E or W
	// Trim the string!
	//Match spaces at beginning and end of text and replace
	//with null strings
	//'/' begins and ends a regular expession
	//'^' Tells us to start at the beginning
	//'\s' is the escape for white space
	//'+' adds continuously such as "ssss" would gather all s'
	//'$' begins at the right and works backwards
	strLon = strLon.replace(/^\s+/,'').replace(/\s+$/,'');
	if(strLon.indexOf("E") != -1) // Set for eastern Longitudes.
	{ // replace "E" with "" to clear the alpha Char and set Hemi to Neg.
		strLon = strLon.replace("E", "");
		Hemisphere = 1;
	}
	if(strLon.indexOf("-") == 0) // check for neg char for Western Hemisphere
	{
		strLon = strLon.replace("-", "");
		Hemisphere = -1;
	}
	if(strLon.indexOf('W') != -1) // Clear any "W" values from the Longitude.
	{
		strLon = strLon.replace("W", "");
		Hemisphere = -1;
	}
	// Trim the string again!
	strLon = strLon.replace(/^\s+/,'').replace(/\s+$/,'');
	// Make sure the user didn't use a '-' char to separate numbers.
	// If they did, replace the "-" with white spaces " " for .Split to work.
	strLon = strLon.replace("-", " ");
	// ==============================================
	var Array1 = strLon.split(" ");
	if(Array1.length > 3 || Array1.length == 0) // split the char - if there are more than 3 sets, set to nothing.
	{
		window.alert("Longitude not valid, could not interpret.");
		textbox.value = "";
		return false;
	}
	if(Array1.length == 1) // decimal notation already
	{
		DecimalDeg = parseFloat(Array1[0].toString());
		if(isNaN(DecimalDeg))
		{
			window.alert("Can not interpret the longitude.");
			textbox.value = "";
			return false;
		}		
		if(DecimalDeg > 180)
		{
			window.alert("Longitude can not exceed 180 degrees.");
			textbox.value = "";
			return false;
		}
		Degrees = Math.floor(DecimalDeg);
		Minutes = (DecimalDeg - Degrees) * 60;
		Seconds = (Minutes - Math.floor(Minutes)) * 60;
		if(Hemisphere == 1)
		{
			textbox.value = Format3Zeros(Degrees) + " " + Format2Zeros(Math.floor(Minutes)) + " " + Format2Zeros2Decimals(Seconds) + " E";
		}
		else
		{
			textbox.value = Format3Zeros(Degrees) + " " + Format2Zeros(Math.floor(Minutes)) + " " + Format2Zeros2Decimals(Seconds) + " W";
		}			
		return true;
	}
	if(Array1.length == 2) // degrees minutes - decimal minutes.
	{
		DecimalDeg = parseFloat(Array1[0].toString());
		if(isNaN(DecimalDeg))
		{
			window.alert("Can not interpret the longitude.");
			textbox.value = "";
			return false;
		}		
		if(DecimalDeg > 180)
		{
			window.alert("Longitude can not exceed 180 degrees.");
			textbox.value = "";
			return false;
		}
		Degrees = Math.floor(DecimalDeg);
		Minutes = parseFloat(Array1[1].toString());
		if(isNaN(Minutes))
		{
			window.alert("Can not interpret the longitude.");
			textbox.value = "";
			return false;
		}		
		if(Minutes > 59)
		{
			window.alert("Longitude minutes can not exceed 59.");
			textbox.value = "";
			return false;
		}
		Seconds = (Minutes - Math.floor(Minutes)) * 60;
		if(Hemisphere == 1){
			textbox.value = Format3Zeros(Degrees) + " " + Format2Zeros(Math.floor(Minutes)) + " " + Format2Zeros2Decimals(Seconds) + " E";
		}
		else //display south for - hemispheres
		{
			textbox.value = Format3Zeros(Degrees) + " " + Format2Zeros(Math.floor(Minutes)) + " " + Format2Zeros2Decimals(Seconds) + " W";
		}			
		return true;
	}
	if(Array1.length == 3) // degrees minutes and seconds.
	{
		Degrees = Math.floor(Array1[0].toString());
		if(isNaN(DecimalDeg))
		{
			window.alert("Can not interpret the longitude.");
			textbox.value = "";
			return false;
		}		
		if(DecimalDeg > 180)
		{
			window.alert("Longitude can not exceed 180 degrees.");
			textbox.value = "";
			return false;
		}
		Minutes = Math.floor(Array1[1].toString());
		if(isNaN(Minutes))
		{
			window.alert("Can not interpret the longitude.");
			textbox.value = "";
			return false;
		}		
		if(Minutes > 59)
		{
			window.alert("Longitude minutes can not exceed 59.");
			textbox.value = "";
			return false;
		}
		Seconds = parseFloat(Array1[2].toString());
		if(isNaN(Seconds))
		{
			window.alert("Can not interpret the longitude.");
			textbox.value = "";
			return false;
		}		
		if(Seconds > 59.99)
		{
			window.alert("Longitude seconds can not exceed 59.99.");
			textbox.value = "";
			return false;
		}
		if(Hemisphere == 1){
			textbox.value = Format3Zeros(Degrees) + " " + Format2Zeros(Minutes) + " " + Format2Zeros2Decimals(Seconds) + " E";
		}
		else//display west for - hemispheres
		{
			textbox.value = Format3Zeros(Degrees) + " " + Format2Zeros(Minutes) + " " + Format2Zeros2Decimals(Seconds) + " W";
		}		
		return true;
	}
}
// STRING and FORMATTING FUNCTIONS!!!!
function strtrim()
	{
	//Match spaces at beginning and end of text and replace
	//with null strings
	return this.replace(/^\s+/,'').replace(/\s+$/,'');
	}
function Format2Zeros(number)
{
	var strTemp = new String(number);
	if(number < 10)
	{
		strTemp = "0" + strTemp;
	}
	return strTemp;
}
function Format3Zeros(number)
{
	var strTemp = new String(number);
	if(number < 100)
	{
		strTemp = "0" + strTemp;
	}
	if(number < 10)
	{
		strTemp = "0" + strTemp;
	}
	return strTemp;
}
function Format2Zeros2Decimals(number)
{
	var RoundedNumber = (parseInt(number * 100)) / 100;
	var strTemp = new String(RoundedNumber);
	if(number < 10)
	{
		strTemp = "0" + strTemp;
	}
	if(strTemp.length == 2)
	{
		strTemp = strTemp + ".00";
	}
	if(strTemp.length == 4)
	{
		strTemp = strTemp + "0";
	}
	return strTemp;
}