//*****************************************
// LIB
//*****************************************

//*****************************************
// PORTAL
//*****************************************
 //*************************
 var formM=true;
 //*******************************
 function formConf(ob,ev) {
  if (ev.ctrlKey) return;
  if (ob.value=='Exclui' && !confirm('Confirma EXCLUSÃO?')) {
    return;
  }
  ob.form['modo'].value = ob.value;
  ob.form.submit();
 }
 //*******************************
 function desv(o,ev) {
  if (ev.ctrlKey) return;
  window.location=o;
 }
 //*******************************
 function edit(o,ev) {
  if (ev.ctrlKey) return;
  var e = '?alt=1&'+o;
  var w = new winDep(window,e);w.frame=true;
  w.centrada=false;w.w=600;w.h=200;w.abre();
 }
 
 //*******************************
 function impr(o,ev) {
  if (ev.ctrlKey) return;
  var w = new winDep(window,o);w.frame=false;
  w.centrada=false;w.w=500;w.h=500;w.abre();
 }
 //*******************************
 function pop(o,ev,tw,th) {
  if (ev.ctrlKey) return;
  if (vazio(tw)) tw=400;
  if (vazio(th)) th=400;
  var w = new winDep(window,o+'&pop=1');
  //w.frame=true;
  //w.resize = false;
  //w.scr = false;
  w.centrada=true;w.w=tw;w.h=th;w.abre();
 }
 
 //*******************************
 function imgJanL() {
  return;
  var i = browse.getId('imagem');
  if (i.width/window.innerWidth>i.height/window.innerHeight) {
   i.width=window.innerWidth-45;
  } else {
   i.height=window.innerHeight-60;
  }
  //i.height=window.innerHeight-60;
  //objNav(i);
 }
 //*******************************
 function imgJanR(url) {
  //imgJanL();
  //alert('resize');
  browse.getId('imgZoom').style.width='95%';
 }
 //*******************************
 function imgJan(url,w,h,ev) {
  if (ev.ctrlKey) return;
  var dx=25,dy=55;
  var mx = browse.tamWinX(janRaiz())-dx;
  var my = browse.tamWinY(janRaiz())-dy-(browse.ie?10:0);
  //alert(mx+' '+my);
  var z = w/mx;
  if (h/my>z) {
   z = h/my;
  }
  var nw = w,nh=h;
  if (z>1) {
   nw = Math.floor(w/z);
   nh = Math.floor(h/z);
  }
  //alert('u='+url+' w='+w+' h='+h+' z='+z+' nh='+nh);
  var wi = new winDep(this,'?img='+url+'&w='+nw+'&h='+nh+'&z='+z);
  wi.w=nw+dx;
  wi.h=nh+dy;
  wi.scr = 'yes';
  wi.centrada = false;
  wi.abre();
 }
 //*********************************
 function ValDataPor(o,op) {
  var v,h=new Date;
  v = troca(trimm(o.value),' ','/');
  if (v.length==0) {
   return true;
  }
  if (!ValCharPor(v,'0123456789/')) {
   alert('ERRO, formato da data é: dd/mm/aaaa,\n use somente números e "/"');
   return false;
  }
  v = palavraA(v,'/');
  if (typeof(v[1])=='undefined') { 
   v[1] = h.getMonth()+ ((true) ? 1 : 0);
  }
  if (typeof(v[2])=='undefined') {
    v[2] = h.getFullYear();
  }
  if (v[2]/1<20) { 
   v[2] = '20'+strZero(v[2],2);
  }
  if ((v[2]/1)<100) { 
   v[2] = '19'+strZero(v[2],2);
  }
  h1 = new Date(v[2]-0,v[1]-1,v[0]/1);
  o.value=strZero(h1.getDate(),2)+'/'
   +strZero(h1.getMonth()+1,2)+'/'+h1.getFullYear();
  return true;
 }
 //*********************************
 function ValCharPor(a,tb) {
  var i;
  for (i=0;i<a.length;i++) if (tb.indexOf(a.substring(i,i+1))<0) return false;
   return true;
 }
//fim PORTAL
//*****************************************

