function radioValue(radio) {

	var resp = "";

	for (var i=0; i < radio.length; i++) {

		if (radio[i].checked) { resp = radio[i].value; break; }		

	}

	return resp;

}



function selectValue(select) {

	var resp = "";

	for (var i=0; i < select.length; i++) {

		if (select[i].selected) { resp = select[i].value; break; }		

	}

	return resp;

}



function formataMoeda(obj,e) {

    var strCheck = '0123456789';

    var whichCode = (window.Event) ? e.which : e.keyCode;

    var key = String.fromCharCode(whichCode);

    if (strCheck.indexOf(key) == -1) return false;

    if (obj.value.length == 0) {

    	obj.value = '0.0';

    } else {

    	valor = parseFloat(obj.value);

    	if (valor < 1) {

    		obj.value = obj.value.substr(2,1) + "." + obj.value.substr(3,1);

    	} else {

    		var partes = obj.value.split(".");

    		if (partes.length != 2) obj.value = '0.0';

    		else obj.value = partes[0] + partes[1].substr(0,1) + "." + partes[1].substr(1,1);

    	}

    }

   	return true;

}



function formataPeriodo(obj,e) {

    var strCheck = '0123456789';

    var whichCode = (window.Event) ? e.which : e.keyCode;

    var key = String.fromCharCode(whichCode);

    if (strCheck.indexOf(key) == -1) return false;

    if (obj.value.length == 2) obj.value += '/';

   	return true;

}



function soNumero(obj,e) {

    var strCheck = '0123456789';

    var whichCode = (window.Event) ? e.which : e.keyCode;

    var key = String.fromCharCode(whichCode);

    if (strCheck.indexOf(key) == -1) return false;

   	return true;

}



function resetaNumeros(obj,e) {

    var strCheck = '0123456789';

    var whichCode = (window.Event) ? e.which : e.keyCode;

    switch (whichCode) {

    	case 8:	case 37: case 46: case 39:

    		obj.value = '';

    	break;

    }

}



function alterna() {

	i = 1;

	while (document.getElementById('destaque' + i) != null) {

		if (i == daVez) {

			document.getElementById('destaque' + i).style.display = '';

		} else {

			document.getElementById('destaque' + i).style.display = 'none';

		}

		i++;

	}

	if (document.getElementById('destaque' + (daVez+1)) == null) {

		daVez = 1;

	} else {

		daVez = (daVez + 1);

	}

}



function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}
function abre_planta(end,nome,features) { //v2.0
  window.open(end,nome,features);
}
function ver_show(targetElement, duration, from, to, toggle)
{
	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}