function toInt ( x )
{
	return ( x > 0 ? Math.floor( x ) : Math.ceil ( x ) );
}

function DECtoDEG(tmp)
{ 

	deg = toInt(tmp);	
	tmp = (tmp-deg) * 60;
	min = toInt(tmp);	
	sec = ((tmp-min) * 60).toFixed(2);	
	return ""+deg+"°"+min+"\'"+sec+"\'\'";
}

function convertLAT(tmp)
{
	dir = "N";
	if (tmp<0) dir="S";	
	return dir+" "+DECtoDEG(Math.abs(tmp)); 	
}

function convertLNG(tmp)
{
	dir = "E";
	if (tmp<0) dir="W";

	return dir+" "+DECtoDEG(Math.abs(tmp)); 

}

