function SwapOut(id, idx) {
  id.src = Rollimage[idx + 1].src;
  return true;
}

function SwapBack(id, idx) {
  id.src = Rollimage[idx].src; 
  return true;
}

function isBrowserIE() {
  return (navigator.appName != "Netscape");
}

function getComponent(id) {
  var component = null;
  if (isBrowserIE()) {
	component = eval(id);
  } else {
	component = document.getElementById(id);
  }
  return component;
}

function tbodyIsDisplayed(tbody) {
  if (typeof(tbody) != 'undefined') {
    if (tbody.style.display == '') {
  	  return true;
    } else if(tbody.style.display == 'none') {
	  return false;
    }
  }
}

var imagePlus;
var imageMinus;

if (document.images) {
  imagePlus = new Image();
  imageMinus = new Image();

  imagePlus.src = "images/mais.gif";
  imageMinus.src = "images/menos.gif";
}

function changeTBodyDisplay(id) {
  var imagem = document.images[id + "_image"];
  if (imagem.src == imagePlus.src) {
    imagem.src = imageMinus.src;
  } else if (imagem.src == imageMinus.src) {
	imagem.src = imagePlus.src;
  }
  var tbody = getComponent(id);
  if (typeof(tbody) != 'undefined') {
	tbody.style.display = (tbodyIsDisplayed(tbody))?'none':'';
  }
}

function openWindow(theURL, winName, features) {
  window.open(theURL, winName, features);
}

function calcularTaxaPayPal(valor, resultado) {
  var taxa = eval(eval(valor / 0,961) + 0,3);
  if (taxa == Infinity) {
    taxa = eval(eval(valor / 0.961) + 0.3);
  }
  var rlength = 2;
  var newTaxa = Math.round(taxa*Math.pow(10, rlength)) / Math.pow(10, rlength);
  resultado.value = newTaxa;
}

function OpenRegWin(url)  {

  var height = 480                       //Set height
  var width = 650                        //Set width
  var name = "winnew"             //Set window name
  var top = 10                            //Set distance from top
  var left = 50                            //Set distance from bottom
  winInfo=window.open(url, name, "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top);

  winInfo.focus();

}