function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


// Validação dos formulários -->
function validaFormAuto(form)
{
  for (i=0;i<form.length;i++)
{
      if (form[i].value == "")
      {
      if (form[i].id.length > 0)
      {
      var nome = form[i].name.substring(1,form[i].name.length);
      var ident = form[i].id;
      alert("O campo [" + ident + "] é necessário."); return false;  
		
      form[i].focus();
       
      }
    }
  }
 return true;  
}


function mostra(div){ // exibe elementos ocultos
        d = document;
		d.getElementById(div).style.display = "block";
}


function mostraFiles(div, valor, span, fotoX){ // exibe elementos ocultos
        d = document;
		d.getElementById(div).style.display = "block";
		d.getElementById('campo').value = valor;
		d.getElementById('fotoX').value = fotoX;
		d.getElementById('span').innerHTML = span;
}


function esconde(idd){
        d = document;
        d.getElementById(idd).style.display = 'none';
		//document.getElementById('tt').innerHTML = "<b><a href=\"#\" onClick=\"return mostra('boxV');\">Fechou...Abrir de novo?</a></b>";
}




// dragdrop simples
// http://cauguanabara.jsbrasil.com/blog/2007/06/03/drag-e-drop-em-javascript/
function initDragDrop() {
					__dragX = 0; 
					__dragY = 0; 
					__dragId = ''; 
					__dragging = false;
					document.body.onmousedown = __dragDown;
					document.body.onmousemove = __dragMove;
					document.body.onmouseup = function() { __dragging = false; };
}

function __dragDown(e) {
				e = e ? e : window.event;
				__dragEl = document.getElementById(__dragId) || null;
				var _target = document.all ? e.srcElement : e.target;
					if(!__dragEl || !(/drag/.test(_target.className))) return;
				__dragX = e.clientX - __dragEl.offsetLeft;
				__dragY = e.clientY - __dragEl.offsetTop;
				__dragging = true;
};

function __dragMove(e) {
						if(typeof __dragging == 'undefined' || !__dragging) return;
					e = e ? e : window.event;
					__dragEl.style.left = (e.clientX - __dragX)+'px';
					__dragEl.style.top = (e.clientY - __dragY)+'px';
};
