// JavaScript Document
function submitcard()
{
  document.card.target = "_self";
  document.card.submit();
}

function submittemplate()
{
  document.card.target = "template";
  window.open ("", "template",'location=no,status=no,toolbar=no,scrollbars=yes,width=650,height=600');
  document.card.submit();
}

function submitform()
{
  document.emkt.target = "_self";
  document.emkt.submit();
}

function submitcampo()
{
  document.campo.target = "_self";
  document.campo.submit();
}

function ivOpen(sLocation, sName, iWidth, iHeight, sFeatures)
{
 /*** Centralizado ***/
 if (navigator.userAgent.toLowerCase().indexOf("msie") != -1)
 {
  var iLeft, iTop, wndPopup;  iLeft = parseInt((screen.width / 2) - (iWidth / 2));  iTop  = parseInt((screen.height / 2) - (iHeight / 2));  wndPopup = window.open(sLocation, sName, sFeatures + ",top=" + iTop +  ",left=" + iLeft + ",width=" + iWidth + ",height=" + iHeight);  wndPopup.moveTo(iLeft,iTop); }
 else
 {
  wndPopup = window.open(sLocation, sName, sFeatures + ",top=50,left=50,width=" + iWidth + ",height=" + iHeight); 
 }
}

// Enviar formulário e abrir janela (Templates)
function submittemplate()
{
  document.enviar.target = "template";
  window.open ("", "template",'location=no,status=no,toolbar=no,scrollbars=yes,width=650,height=600');
  document.enviar.submit();
}

function submitcookie()
{
  document.enviar.target = "topFrame";
  document.enviar.action = 'cookies.php';
  document.enviar.submit();
}

function submitreport()
{
  document.enviar.target = "topFrame";
  document.enviar.action='actions/salvar_report.php';
  document.enviar.submit();
}

// validação de campos
function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,3)=="cd_") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(3,30).toUpperCase();
alert("Preencha o campo "+shortFieldName+".");
return false;
}
else
return true;
}