//AJAX
function openAjaxXx() {
var AjaxXx;
try {AjaxXx = new XMLHttpRequest(); // XMLHttpRequest para browsers mais populares, como: Firefox, Safari, dentre outros.
}catch(ee){
try {AjaxXx = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS
}catch(e){
try {AjaxXx = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS
}catch(e){AjaxXx = false;}
}
}
return AjaxXx;
}

//Seleciona Categoria
function SelCat(id){
	window.open('?p=fotos&cat='+id, '_parent');
}

//Upload de Fotos
function uploadDeFoto(pag, img){
	window.open(pag+'img='+img,'','resizable=0,Menubar=no,toolbar=no,scrollbars=0,status=0,top=0,left=0,screenX='+window.screenLeft+',screenY='+window.screenTop+',width=800,height=500');
}

//Abre Observação Cartões de Crédito
function abreObsCartao(){
    window.open('dicas,cartao.html','','resizable=0,Menubar=no,toolbar=no,scrollbars=0,status=0,top=0,left=0,screenX='+window.screenLeft+',screenY='+window.screenTop+',width=455,height=368');
}

//ABRIR JANELA
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//SHOW
function show(id){
  caixa = document.getElementById(id);
  caixa.style.display = "";
}
//HIDE
function hide(id){
caixa = document.getElementById(id);
caixa.style.display = "none";
}

//Excluir
function Excluir(id, bd, pasta, img, pagina){
  if (confirm("Confirma a exclusão? (Isso será um ato irreversível!)")){
    window.location="_php/Excluir.php?Id="+id+"&Bd="+bd+"&Pasta="+pasta+"&Img="+img+"&Pagina="+pagina;
  }
}

//LIMPA CAMPO
function limparCampo(id, cont){
  var campo = document.getElementById(id);
  if (campo.value == cont){
    campo.value = '';
  }else if(campo.value == ''){
    campo.value = cont;
  }
}

function ValidaCod(dig){
  var ori = document.form1.cod_.value;
	if(dig.length>5){
	    if(dig == ori){
		   document.form1.bt.disabled = false;
		   document.getElementById('Result').innerHTML = "<font color='#060'>Código Correto!</font>";
	    }else{
		   document.form1.bt.disabled = true;
		   document.getElementById('Result').innerHTML = "<font color='#FF0000'>Código Errado!</font>";
	    }
	}else{
		document.getElementById('Result').innerHTML = "";
	}
}

//Escreve o Flash
function flash(largura, altura, arquivo){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+largura+'" height="'+altura+'" id="teste" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	//document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+arquivo+'" /><param name="quality" value="best" /><embed src="'+arquivo+'" quality="best" width="'+largura+'" height="'+altura+'" name="teste" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

//VALIDA LOGIN
function validaLogin(){
		if (document.form_ev.email_ev.value.length<5 || document.form_ev.email_ev.value.indexOf("@")<=0 || document.form_ev.email_ev.value.indexOf(".")<=0){
  		  alert ("Por favor, informe seu e-mail válido!");
  		  document.form_ev.email_ev.focus();
  		  return false;
		}
		else if (document.form_ev.senha_ev.value=="" || document.form_ev.senha_ev.value.length<6){
  		  alert("Por favor, informe sua senha!");
  		  document.form_ev.senha_ev.focus();
  		  return false;
		}
}
//VALIDA LEMBRAR
function validaLembrar(){
		if (document.form_lev.cpf.value=="" || document.form_lev.cpf.value.length<10){
  		  alert("Por favor, informe o seu CPF");
  		  document.form_lev.cpf.focus();
  		  return false;
		}
}