// JavaScript Document

// Form

/**
 * Define o controle de formulário de coordenadas 
 *
 */
var input_long = new inputCoord( "longitude_dec", "longitude_polar");
var input_lat = new inputCoord( "latitude_dec", "latitude_polar");
function setCoordControl() {

	var formato = document.getElementsByName( "formato" );
	for ( var i=0; i < formato.length; i++ ) {
		formato[i].onclick = function() {
			input_long.setInputFormat( this.value );
			input_lat.setInputFormat( this.value );
		}
	}
}
setCoordControl();

function setInputFormat( value ) {
	input_long.setInputFormat( value );
	input_lat.setInputFormat( value );
}

// Data

var data_ren = new DataRen( "data_output" );
document.getElementById("submit_btn").onclick = function() {
	if( browserSupportsAjax() ) {
		var coord =	formValidation();
		data_ren.setCoord( coord );
		data_ren.getDataByCoord();
		window.location = '#data';
		goSetDimensions();		
	} else {
		submitButton();
	}
}
document.getElementById("reset_btn").onclick = function() {
	clearInputs( "dataForm" );
}

// Switch Content initialization

	// MAIN FUNCTION: new switchcontent("class name", "[optional_element_type_to_scan_for]") REQUIRED
	// Call Instance.init() at the very end. REQUIRED

//var sd=new switchcontent("switchgroup1", "div") //Limit scanning of switch contents to just "div" elements
//sd.setStatus('<img src="images/minus.gif" /> ', '<img src="images/plus.gif" /> ')
//sd.setColor('#000000', '#0066CC')
//sd.setPersist(true)
//sd.collapsePrevious(false) //Only one content open at any given time
//sd.init()
