//*********************************
// Signey jun/2004
//*********************************
 /* ALTERAÇÕES
 15/07 - background-color e +
 16/07 - campos ajuda pequenos + contator defs
 20/07 - tag com mais de uma classe
 29/07 - ! important 
 01/08 - php sem globais
 */
var jsCSSEditorD = new Array();
var corO,corNM;

//*********************************
// entrada dados gráfica cor
//*********************************
 function setParN(sV,p,nV) {
  var v = palavraA(trocaTudo(trimm(sV),'  ',' '),' ');
  v[p] = nV;
  var r = '';
  for (var i=0;i<v.length;i++) {
   if (!vazio(v[i])) {
    r += ' '+v[i];
   }
  }
  return r.substring(1);
 }
 //*********************************
 function selCor2(cor) {
  //alert('cor '+corNM+' o='+corO);
  corO.style.background = cor;
  //alert(corO.form[corNM].onchange);
  corO.form[corNM].value = cor;
  janLocObj("oCSS").muda(corO.form[corNM],window);
  //corO.form[corNM].onchange();
  //alert('cor sel: '+cor+' = '+corO.style.background);
 }
 //*********************************
 function selCor(o,nm) {
  corO = o;corNM=nm;
  //alert(o.style.background);
  var j = new winDep(top,'/jsCSSEditor.php?op=pal&ex=opener.selCor2('
  +'&cor='+corToHex(o.style.background).substring(1));
  j.abre();
 }
 //*********************************
 function color(v) {
  var c = corToHex(v[1]);
  //alert(v[1]);
  return '<input onClick=selCor(this,"'+v[0]+'"); style="background:'+c
  +';" class=selCor type=button name=cor_'+v[0]+'>'
  +'<input type=hidden name='+v[0]+' value='+v[1]+'>'
  ;
 }
 //*********************************
 function corToHex(c) {
  if (c.indexOf('(')!=-1) {
   var v = palavraA(substrAtAt(c,'(',')'),',');
   //alert(v.length);
   if (v.length>2) {
    return '#'+hexRgb(v[0],v[1],v[2]);
   }
  }
  return c;
 }
//fim entrada cores

//*********************************
//o EDITOR
//*********************************
function jsCSSEditor(t,e) {
 //constroi
  var gravador = '/jsCSSEditor.php';
  if (typeof(t)!='undefined') {
   janPrin(t,e);
   return;
  }
  top.document.title = 'jsCSSEditor';
  var oEv = top.opener.jsCSSEditorD[0];
  var oSt = top.opener.jsCSSEditorD[1];
  var fl = new Array();
  var fln = new Array();
  var ob = new Array();
  var cor = new Array();
  var propAd = new Array();
  var clasAd = new Array();
  this.edit = edit;
  this.muda = muda;
  this.ajuda = ajuda;
  this.grava = grava;
  this.important = important;
  this.editA = editA;
  this.folha = folha;
  this.addProp = addProp;
  this.addEst = addEst;
  this.lista = lista;
  this.coresP = coresP;
  this.volta = volta;
  //lista();
 //fim constroi

 //*********************************
 //set important
 function important(o,cmp,win) {
  if (o.form[cmp].value.indexOf('!')==-1) {
   o.form[cmp].value += ' ! important';
  } else {
   o.form[cmp].value = trimm(leftAt(o.form[cmp].value,'!'));
  }
  this.muda(o.form[cmp],win);
 }
 //*********************************
 //retorna cores personaliz
 function coresP() {
  return cor;
 }
 //*********************************
 //mostra folha
 function folha(f) {
  //objNav(fl[f]);
  for (var i=0;i<fl[f].cssRules.length;i++) {
   document.write('<br>'+fl[f].cssRules[i].selectorText);
  }
 }
 //*********************************
 //adiciona sub estilo
 function addEst(o,win) {
  var v = trimm(o.value);
  if (o.value=='') {
   return;
  }
  var fo = o.form._fl.value;
  var ch = fo+"@"+o.name.substring(1)+o.value;
  if (o.name.substring(0,2)=='__') {
   ch = fo+"@"+o.name.substring(2)+' '+o.value;
  }
  //alert(ch);
  if (typeof(propAd[ch])!='undefined') {
   alert('JÁ EXISTE... '+ch);
  } else {
   propAd[ch] = new estilo();
   win.location = gravador+'?_it='+o.form._it.value
    +'&_sIt='+o.form._sIt.value;
  }
 }
 //*********************************
 //adiciona nova prop ao estilo
 function addProp(o,win) {
  var fo = o.form._fl.value,st = o.form._st.value;
  propAd[fo+"@"+st].put(o.value,'');
  win.location = gravador+'?_it='+o.form._it.value
   +'&_sIt='+o.form._sIt.value;
  ;
 }
 //*********************************
 //abre jan p/target e submit
 function grava(o,ev) {
  if (ev.ctrlKey) {
   return;
  }
  var w = new winDep(top,'');
  w.w = 200;w.h = 200;
  w.nome = '_cssGrava';
  w.abre();
  o.form.submit();
 }
 //*********************************
 //preenche o input com o select
 function ajuda(o) {
  var n = o.name.substring(1);
  o.form[n].value = o.value;
  muda(o.form[n]);
 }
 //*********************************
 //volta valor original
 function volta(o,win) {
  var no = o.name.substring(7);
  //alert(no);
  o = o.form[no];
  var f = o.form._fl.value;
  var st = o.form._st.value;
  var ch = f+'@'+st;
  var es = propAd[ch];
  if (!es.alterado(no)) {
   return;
  }
  var i = es.i[no];
  o.value = es.v[i][2];
  this.muda(o,win);
 }
 //*********************************
 //altera prop estilo cfrme alt usuário
 function muda(o,win) {
  var no = o.name;
  if (no.substring(0,1)=='_') {
   //muda sub-campo...
   no = no.substring(1);
   var p = 1*leftAt(no,'_');
   no = substrAt(no,'_');
   var oo = o;
   o = oo.form[no];
   o.value = setParN(o.value,p,oo.value);
  }
  var f = o.form._fl.value;
  var vs = trimm(o.value);
  var st = o.form._st.value;
  var ch = f+'@'+st;
  var va = propAd[ch].get(o.name);
  //atualiza
  propAd[ch].put(o.name,o.value);
  //deleta e reinsere
  delSt(f,st);
  var aa = st+' { '+propAd[ch].tex()+' }';
  fl[f].insertRule(aa,fl[f].cssRules.length);
  //compara o q o brow aceitou
  var alvo = locSt(f,st);
  if (alvo==null) {
   alert('browse não aceitou estilo='+st);
   return;
  }
  var es = new estilo('',alvo);
  if (vs!='' && es.get(o.name)!=o.value) {
   if (vazio(es.get(o.name))) {
    propAd[ch] = es;
    win.location = gravador+'?_it='+o.form._it.value;
   } else {
    o.value = es.get(o.name);
    propAd[ch].put(o.name,o.value);
   }
  }
  //tem undo
  es = propAd[ch];
  //alert(ch);
  o.form['_volta_'+no].className = 'volta'+(es.alterado(no)?'S':'');
 }
 //*********************************
 //input GRAFICO se existe
 function inputG(v) {
  var o = pr[v[0]];
  if (typeof(o)=='string') {
   o = pr[o];
  }
  var r = '',ee;
  var v1 = palavraA(o[0][1],' ');
  if (vazio(v[1])) {
   v[1] = trimm('? ? ? ? ? ? ? ?'.substring(0,v1.length*2));
  }
  var v2 = palavraA(v[1]+'      ',' ');
  for (var i=0;i<v1.length;i++) {
   var n = '_'+i+'_'+v[0];
   if (v1[i].substring(0,1)=='(') {
    try {
     ee = eval(trimm(v1[i],') (')+'(new Array(n,v2[i]))');
    } catch (e) {
     ee = ' ?'+v1[i]+'='+e+'? ';
    }
   } else if (v1[i]=='-') {
    //ignora
    ee = '';
   } else {
    ee = editI(Array(v1[i],v2[i]),n);
   }
   r += ee;
  }
  return r;
 }
 //*********************************
 //input 1 prop
 function editI(v,nome) {
  ne = vazio(nome);
  var oc = ' onchange=janLocObj("oCSS").muda(this,window);>';
  var r = '';
  if (vazio(v[0])) {
   return r;
  }
  r = '<input type=text class=propInp name="'+(ne?v[0]:nome)+'" value="'+v[1]
   +'" size='+(vazio(v[1])?15:Math.floor(v[1].length*1.25))
   +oc;
  //tem ajuda ou +
  var r1='';
  var o = pr[v[0]];
  if (typeof(o)=='string') {
   o = pr[o];
  }
  var sos = false;
  if (o!=null && o[0][0]!='prg') {
   sos = o[0][1].indexOf('(')==-1 && o[0][1]!='';
   if (sos) {
    r1 = '<select class=propInp'
     +' name='+(ne?v[0]:nome)+oc+'<option>';
   } else  {
    r1 = '<select class=propAju'
     +' name=_'+(ne?v[0]:nome)+troca(oc,'.muda(','.ajuda(');
   }
   for (var i=0;i<o.length;i++) {
    r1 += '<option '+(o[i][1]==v[1]?'selected':'')+'>'+o[i][1];
   }
   r1 += '</select>';
  }
  if (o!=null && ne && o[0][0]=='prg') {
   //r = troca(r,'=text ','=hidden ')+inputG(v);
   r += troca(inputG(v),'=propInp','=propInp1');
  } else if (sos) {
   r = r1;
  } else if (ne || (o!=null && o[0][1]=='')) {
   r += r1;
  }
  return r;
 }
 //*********************************
 //*********************************
 function estilo(ch,o) {
  this.ch = ch;
  this.v = Array();
  this.i = Array();
  this.tex = tex;
  this.put = put;
  this.get = get;
  this.alterado = alterado;
  if (typeof(propAd[ch])!='undefined') {
   //clona
   //alert('clone='+propAd[ch]);
   this.v = propAd[ch].v;
   this.i = propAd[ch].i;
  } else if (o!=null) {
   //puxa dos obj browser
   var vt = palavraA(trimm(''+o.cssText,';'),';');
   for (var i=0;i<vt.length;i++) {
    vt[i] = trimm(vt[i]);
    if (vt[i].substring(0,5)=='-moz-') {
    } else if (vt[i].indexOf(':')!=-1) {
     var pr = trimm(leftAt(vt[i],':'));
     this.put(pr,trimm(substrAt(vt[i],':')));
    } else {
     this.put(vt[i],'');
    }
   }
  }
  if (ch!='') {
   propAd[ch] = this;
  }
  //*********************************
  function norm(v) {
   var n;
   v = trocaTudo(trocaTudo(trimm(v),', ',','),'  ',' ');
   var vt = palavraA(v,' '),r='';
   for (var i=0;i<vt.length;i++) {
    if (vt[i].length>4 && vt[i].substring(0,4)=='rgb(') {
     vt[i] = corToHex(vt[i]);
    }
    r += ' '+vt[i];
   }
   return (r==''?r:r.substring(1));
  }
  //*********************************
  function put(ch,v) {
   var i = this.i[ch];
   v = norm(v);
   if (typeof(i)=='undefined') {
    i = this.v.length;
    this.i[ch] = i;
    this.v[i] = Array(ch,v,''+v);
   } else {
    this.v[i] = Array(ch,v,this.v[i][2]);
   }
  }
  //*********************************
  function alterado(ch) {
   var i = this.i[ch];
   if (typeof(i)=='undefined') {
    return false;
   }
   return !(this.v[i][1]==this.v[i][2]);
  }
  //*********************************
  function get(ch) {
   var i = this.i[ch];
   if (typeof(i)=='undefined') {
    return null;
   }
   return this.v[i][1];
  }
  //*********************************
  function tex() {
   var r = '';
   for (var i=0;i<this.v.length;i++) {
    if (trimm(this.v[i][1])!='') {
     r += this.v[i][0]+': '+this.v[i][1]+';';
    }
   }
   return r;
  }
 }
 //*********************************
 // edit todos os props do estilo
 function editE(o,ch) {
  var r = '',prs=',';
  //objNav(o);
  //pega estilos do texto
  var es = new estilo(ch,o);
  //objNav(es);
  var v = es.v;
  for (var i=0;i<v.length;i++) {
   r += '<tr class=tabE><td class=propRot>'+v[i][0]
    +' <input type=button class=volta'+(v[i][1]==v[i][2]?'':'S')
     +' onClick=janLocObj("oCSS").volta(this,window);'
     +' value="" name=_volta_'+v[i][0]+'>'
    +'<td class=propInp>'
    +editI(v[i])
    +'<input alt="! important" type=checkbox '
     +'onchange=janLocObj("oCSS").important(this,"'+v[i][0]+'",window); '
     +(v[i][1].indexOf('important')!=-1?'checked':'')+'>'
   ;
  }
  return r;
 }
 //*********************************
 // formulário edição 1 estilo e variantes
 function edit1(st1,it,sIt) {
  var r = '';
  for (var f=0;f<fl.length;f++) {
   var v = locSts(f,st1);
   for (var i=0;i<v.length;i++) {
   var st = v[i];
   //objNav(st);
   //return;
   var s = locSt(f,st);
   r += '<form action='+gravador+' method=post target=_cssGrava>'
    +'<tr class=tabE><td class=tabE colspan=2><font class=tabETit>'
    +st+'</font>'
    +(st.indexOf(':')==-1
     //?' add: <select onChange=top.opener.top.oCSS.addEst(this,window);'
     ?' <font class=propAdd>add</font>'
      +'<select onChange=janLocObj("oCSS").addEst(this,window);'
      +' name="_'+st+'" class=addEst>'+opAddEst()+'</select>'
     :''
     )
    +(st.indexOf('.')!=-1 && st.indexOf(' ')==-1
     ?' <font class=propAdd>add</font>'
      +'<input onChange=janLocObj("oCSS").addEst(this,window);'
      +' name="__'+st+'" size=4 class=addEst>'
     :''
     )
   +'<input type=hidden name=_fl value='+f+'>'
   +'<input type=hidden name=_fln value="'+fln[f]+'">'
   +'<input type=hidden name=_st value="'+st+'">'
   +'<input type=hidden name=_it value="'+it+'">'
   +'<input type=hidden name=_sIt value="'+sIt+'">'
   ;
   //if (s!=null) {
    r += editE(s,f+'@'+st);
   //}
   //top.opener.top.oCSS.muda(this);
   r += '<tr class=tabE><td class=propAdd>add<td>'
   +'<select class=propAdd name=_addProp '
   +'onChange=janLocObj("oCSS").addProp(this,window);><option>';
   //+'onChange=top.opener.top.oCSS.addProp(this,window);><option>';
   for (prop in pr) {
    if (prop.substring(0,1)!='_') {
     r += '<option>'+prop;
    }
   }
   r += '</select>'
   +'<tr class=tabE><td class=estGrava colspan=2>'
   +'<input class=estGrava type=button '
   //+'onClick=top.opener.top.oCSS.grava(this,event);'
   +'onClick=janLocObj("oCSS").grava(this,event);'
   +' value="write '+fln[f]+'">'
   +'</form>'
   ;
  }
  }
  return r;
 }
 //*********************************
 // monta html edit classes
 function edit(it,sIt,doc) {
  var d = ob[it];
  var cl = d.className;
  if (cl.indexOf(' ')!=-1) {
   cl = palavraA(cl,' ');
   cl = cl[sIt];
  }
  //objNav(fl[0]);
  doc.write(
  //'<a onClick=objNav(janRaiz());>top</a>
  '<table id=tabR class=tabE>'
  +'<tr class=tabE>'
  +'<th class=tabE colspan=2><h2>Class: '+cl+'</h2>'
  +(cl==''
  ?''
  :edit1(d.tagName+'.'+cl,it,sIt)+edit1('.'+cl,it,sIt)
  )
  +edit1(d.tagName,it,sIt)
  +'</table>fim'
  );
 }
 //*********************************
 // abre janela edit classes
 function editA(it,sIt) {
  //objNav(top);
  var w = new winDep(top,gravador+'?_it='+it+'&_sIt='+sIt);
  w.centrada = false;w.cascata = true;
  w.frame = true;
  //w.debug = true;
  w.scr = 'yes';
  w.abre();
 }
 //*********************************
 //lista estilos atingidos p/alterar
 function lista() {
  var od = top.opener.jsCSSEditorD[0]; //elemento target
  //objNav(od);
  var st = top.opener.jsCSSEditorD[1]; //folhas style
  var r='<table id=tabR class=tabL>'
  +'<tr class=tabL><th class=tabL colspan=3>'
  +'<h2 class=tabL>jsCSSEditor</h2>'
  //+'Ordem: Inverso da Hierarquia';
  for (var i=0;i<st.length;i++) {
   fl[i] = st[i];
   fln[i] = substrAt(substrAt(st[i].href,'//'),'/');
  }
  var i=0;
  while (od!=null) {
   ob[i++] = od;
   try {
    od = od.parentNode;
    if (vazio(od.tagName)) {
     break;
    }
   } catch (e) {
   }
  }
  for (var i=0;i<ob.length;i++) {
   od = ob[i];
   try {
    if (typeof(od.tagName)=='undefined') {
    } else if (od.className=='') {
     r += '<tr class=tabL><td class=tabL>'+(ob.length-i-1)
     +'<td class=tabL>'
     +'<a class=tabL href="javascript:top.oCSS.editA('
     +i+');">'+od.tagName+'</a>'
     +'<td class=tabL>no class'
     ;
    } else {
     r += '<tr class=tabL><td class=tabL>'+(ob.length-i-1)
     +'<td class=tabL>'+od.tagName
     +'<td class=tabL>'
     ;
     v = palavraA(od.className,' ');
     for (x=0;x<v.length;x++) {
      r += (x==0?'':'<br>')
       +'<a class=tabL href="javascript:top.oCSS.editA('
       +i+','+x+');">'+v[x]+'</a>\n';
     }
    }
   } catch (e) {
    r += '<tr class=erro><td class=erro>Error<td class=erro>'+e;
   }
  }
  for (var i=0;i<st.length;i++) {
   r += '<tr><td colspan=3><a href=>'
    +substrAt(substrAt(st[i].href,'//'),'/')+'</a>';
  }
  //;
  //this.pal = new paletaCores('top.oCSS.pal');
  //document.write(''+r+'<tr><td colspan=3>'+this.pal.monta()+'</table>');
  document.write(r+'<tr><td></table>');
  cores();
 }
 //*********************************
 //fora do objeto - cria janela lista
 function janPrin(t,e) {
  if (!e.ctrlKey || e.altKey) {
   return;
  }
  if (!browse.ie) {
   try {
    e.stopPropagation();
   } catch (e) {
   }
  }
  //alert('e='+e);
  //objNav(e);
  //return;
  jsCSSEditorD[0] = targetEvent(e);
  jsCSSEditorD[1] = document.styleSheets;
  //objNav(top);
  
  var w = new winDep(top,gravador);
  w.tipo = 3;
  //w.frame = true;
  w.centrada = false;
  w.abre();
 }
 //*********************************
 //options add estilo
 function opAddEst() {
  return troca('<option>:link:visited:active:hover:focus:lang():first-child'
   +':left:right:first:first-letter:first-line:after:before',
   ':','<option>:');
 }
 //*********************************
 //procura por cores nas folhas
 function cores() {
  for (var f=0;f<fl.length;f++) {
   var o = fl[f].cssRules;
   for (var i=0;i<o.length;i++) {
    var e = new estilo('',o[i]);
    for (var x=0;x<e.v.length;x++) {
     if (e.v[x][1].indexOf('#')!=-1) {
      var c = '#'+substrAtAt(e.v[x][1]+' ','#',' ');
      if (vazio(cor[c])) {
       cor[c] = 0;
      }
      cor[c]++;
     }
    }
   }
  }
 }
 //*********************************
 //localiza estilos na folha
 function locSts(fo,st) {
  var r = new Array(st),t=','+st.toLowerCase()+',';
  var s = st.toLowerCase();
  var o = fl[fo].cssRules;
  for (var i=0;i<o.length;i++) {
   var e = trimm(o[i].selectorText.toLowerCase());
   var s1 = leftAt(e,':');
   var s2 = leftAt(e,' ');
   if ((s1==s || s2==s)  && t.indexOf(','+e+',')==-1) {
    r[r.length] = o[i].selectorText;
    //alert(o[i].selectorText);
    t += e+',';
   }
  }
  
  //procura por criados..
  for (prop in propAd) {
   var f = leftAt(prop,'@');
   var e = trimm(substrAt(prop,'@').toLowerCase());
   var e1 = leftAt(e,':');
   var e2 = leftAt(e,' ');
   if (f==fo && (s==e1 || s==e2) && t.indexOf(','+e+',')==-1) {
    //alert(st+', add='+e);
    r[r.length] = substrAt(prop,'@');
    t += e+',';
   }
  }
  
  //alert('st='+st+' t='+t);
  if (r.length==0) {
   r = new Array(st);
  }
  return r;
 }
 //*********************************
 //deleta estilo na folha
 function delSt(fo,st) {
  var s = st.toLowerCase();
  var o = fl[fo].cssRules;
  for (var i=0;i<o.length;i++) {
   if (o[i].selectorText.toLowerCase()==s) {
    fl[fo].deleteRule(i);
    break;
   }
  }
 }
 //*********************************
 //localiza estilo na folha
 function locSt(fo,st) {
  var r = null;
  var s = st.toLowerCase();
  var o = fl[fo].cssRules;
  for (var i=0;i<o.length;i++) {
   if (o[i].selectorText.toLowerCase()==s) {
    r = o[i].style;
   }
  }
  /*if (typeof(propAd[fo+"@"+st])=='undefined') {
   propAd[fo+"@"+st] = new Array();
  }
  */
  return r;
 }
 //prop possíveis
 //opções baseadas no projeto cssed http://cssed.sourceforge.net
 // por Iago Rubio
 var pr = new Array();
  pr["azimuth"] = Array(
  Array("string","(angle)"),
  Array("fixed-string","inherit"),
  Array("fixed-string","left-side"),
  Array("fixed-string","far-left"),
  Array("fixed-string","left"),
  Array("fixed-string","center-left"),
  Array("fixed-string","center-right"),
  Array("fixed-string","right"),
  Array("fixed-string","far-right"),
  Array("fixed-string","right-side"),
  Array("fixed-string","behind"),
  Array("fixed-string","leftwards"),
  Array("fixed-string","rightwards")
  );
  pr["background"] = Array(
  Array("prg","(color)")
  );
  pr["background-attachment"] = Array(
  Array("string","(color)"),
  Array("fixed-string","inherit"),
  Array("fixed-string","fixed")
  );
  pr["background-color"] = Array(
  Array("prg","(color)")
  );
  pr["background-image"] = Array(
  Array("string","(uri)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["background-position"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","top"),
  Array("fixed-string","center"),
  Array("fixed-string","bottom"),
  Array("fixed-string","left"),
  Array("fixed-string","center"),
  Array("fixed-string","right"),
  Array("fixed-string","inherit")
  );
  pr["background-repeat"] = Array(
  Array("fixed-string","repeat"),
  Array("fixed-string","repeat-x"),
  Array("fixed-string","repeat-y"),
  Array("fixed-string","no-repeat"),
  Array("fixed-string","inherit")
  );
  pr["_dim"] = Array(
  Array("string","0px"),
  Array("string","1px"),
  Array("string","2px"),
  Array("string","3px"),
  Array("string","4px"),
  Array("string","5px"),
  Array("string","6px"),
  Array("string","7px"),
  Array("string","8px"),
  Array("string","9px"),
  Array("string","10px"),
  Array("string","15px")
  );
  pr["border"] = Array(
  Array("prg","_dim border-style (color)"),
  Array("string","(color)"),
  Array("string","(percentage-length)"),
  Array("fixed-string","inherit")
  );
  pr["border-collapse"] = Array(
  Array("fixed-string","collapse"),
  Array("fixed-string","separate"),
  Array("fixed-string","inherit")
  );
  pr["border-spacing"] = Array(
  Array("string","(length)"),
  Array("fixed-string","inherit")
  );
  pr["border-style"] = Array(
  Array("fixed-string","none"),
  Array("fixed-string","hidden"),
  Array("fixed-string","dotted"),
  Array("fixed-string","dashed"),
  Array("fixed-string","solid"),
  Array("fixed-string","double"),
  Array("fixed-string","groove"),
  Array("fixed-string","ridge"),
  Array("fixed-string","inset"),
  Array("fixed-string","outset"),
  Array("fixed-string","inherit"),
  Array("string","(border-style)")
  );
  pr["border-top"] = 'border';
  pr["border-right"] = 'border';
  pr["border-bottom"] = 'border';
  pr["border-left"] = 'border';
  /*
  pr["border-color"] = Array(
  Array("string","(color)"),
  Array("fixed-string","transparent"),
  Array("fixed-string","inherit")
  );
  pr["border-top-color"] = Array(
  Array("string","(color)"),
  Array("fixed-string","inherit")
  );
  pr["border-right-color"] = Array(
  Array("string","(color)"),
  Array("fixed-string","inherit")
  );
  pr["border-bottom-color"] = Array(
  Array("string","(color)"),
  Array("fixed-string","inherit")
  );
  pr["border-left-color"] = Array(
  Array("string","(color)"),
  Array("fixed-string","inherit")
  );
  pr["border-top-style"] = Array(
  Array("fixed-string","none"),
  Array("fixed-string","hidden"),
  Array("fixed-string","dotted"),
  Array("fixed-string","dashed"),
  Array("fixed-string","solid"),
  Array("fixed-string","double"),
  Array("fixed-string","groove"),
  Array("fixed-string","ridge"),
  Array("fixed-string","inset"),
  Array("fixed-string","outset"),
  Array("fixed-string","inherit"),
  Array("string","(border-style)")
  );
  pr["border-right-style"] = Array(
  Array("fixed-string","none"),
  Array("fixed-string","hidden"),
  Array("fixed-string","dotted"),
  Array("fixed-string","dashed"),
  Array("fixed-string","solid"),
  Array("fixed-string","double"),
  Array("fixed-string","groove"),
  Array("fixed-string","ridge"),
  Array("fixed-string","inset"),
  Array("fixed-string","outset"),
  Array("fixed-string","inherit"),
  Array("string","(border-style)")
  );
  pr["border-bottom-style"] = Array(
  Array("fixed-string","none"),
  Array("fixed-string","hidden"),
  Array("fixed-string","dotted"),
  Array("fixed-string","dashed"),
  Array("fixed-string","solid"),
  Array("fixed-string","double"),
  Array("fixed-string","groove"),
  Array("fixed-string","ridge"),
  Array("fixed-string","inset"),
  Array("fixed-string","outset"),
  Array("fixed-string","inherit"),
  Array("string","(border-style)")
  );
  pr["border-left-style"] = Array(
  Array("fixed-string","none"),
  Array("fixed-string","hidden"),
  Array("fixed-string","dotted"),
  Array("fixed-string","dashed"),
  Array("fixed-string","solid"),
  Array("fixed-string","double"),
  Array("fixed-string","groove"),
  Array("fixed-string","ridge"),
  Array("fixed-string","inset"),
  Array("fixed-string","outset"),
  Array("fixed-string","inherit"),
  Array("string","(border-style)")
  );
  pr["border-top-width"] = Array(
  Array("string","(border-width-single)"),
  Array("fixed-string","thin"),
  Array("fixed-string","medium"),
  Array("fixed-string","thick"),
  Array("fixed-string","inherit")
  );
  pr["border-right-width"] = Array(
  Array("string","(border-width-single)"),
  Array("fixed-string","thin"),
  Array("fixed-string","medium"),
  Array("fixed-string","thick"),
  Array("fixed-string","inherit")
  );
  pr["border-bottom-width"] = Array(
  Array("string","(border-width-single)"),
  Array("fixed-string","thin"),
  Array("fixed-string","medium"),
  Array("fixed-string","thick"),
  Array("fixed-string","inherit")
  );
  pr["border-left-width"] = Array(
  Array("string","(border-width-single)"),
  Array("fixed-string","thin"),
  Array("fixed-string","medium"),
  Array("fixed-string","thick"),
  Array("fixed-string","inherit")
  );
  pr["border-width"] = Array(
  Array("string","(border-width)"),
  Array("fixed-string","inherit")
  );
  */
  pr["bottom"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  );
  pr["caption-side"] = Array(
  Array("fixed-string","top"),
  Array("fixed-string","bottom"),
  Array("fixed-string","left"),
  Array("fixed-string","right"),
  Array("fixed-string","inherit")
  );
  pr["clear"] = Array(
  Array("fixed-string","none"),
  Array("fixed-string","bottom"),
  Array("fixed-string","left"),
  Array("fixed-string","both"),
  Array("fixed-string","inherit")
  );
  pr["clip"] = Array(
  Array("string","(shape)"), 
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  );
  pr["color"] = Array(
  Array("prg","(color)"),
  Array("fixed-string","inherit")
  );
  pr["content"] = Array(
  Array("string","(string)"),
  Array("string","(uri)"),
  Array("string","(counter)"),
  Array("string","(attr)"),
  Array("fixed-string","open-quote"),
  Array("fixed-string","close-quote"),
  Array("fixed-string","no-open-quote"),
  Array("fixed-string","no-close-quote"),
  Array("fixed-string","inherit")
  );
  pr["counter-increment"] = Array(
  Array("string","(increment-reset)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["counter-reset"] = Array(
  Array("string","(increment-reset)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["cue"] = Array(
  Array("string","(uri)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["cue-before"] = Array(
  Array("string","(uri)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["cue-after"] = Array(
  Array("string","(uri)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["cursor"] = Array(
  Array("string","(uri)"),
  Array("fixed-string","auto"),
  Array("fixed-string","crosshair"),
  Array("fixed-string","default"),
  Array("fixed-string","pointer"),
  Array("fixed-string","move"),
  Array("fixed-string","e-resize"),
  Array("fixed-string","ne-resize"),
  Array("fixed-string","nw-resize"),
  Array("fixed-string","n-resize"),
  Array("fixed-string","se-resize"),
  Array("fixed-string","sw-resize"),
  Array("fixed-string","s-resize"),
  Array("fixed-string","w-resize"),
  Array("fixed-string","text"),
  Array("fixed-string","wait"),
  Array("fixed-string","help"),
  Array("fixed-string","inherit")
  );
  pr["direction"] = Array(
  Array("fixed-string","ltr"),
  Array("fixed-string","rtl"),
  Array("fixed-string","inherit")
  );
  pr["display"] = Array(
  Array("fixed-string","inline"),
  Array("fixed-string","block"),
  Array("fixed-string","list-item"),
  Array("fixed-string","run-in"),
  Array("fixed-string","compact"),
  Array("fixed-string","marker"),
  Array("fixed-string","table"),
  Array("fixed-string","inline-table"),
  Array("fixed-string","table-row-group "),
  Array("fixed-string","table-header-group"),
  Array("fixed-string","table-footer-group"),
  Array("fixed-string","table-row"),
  Array("fixed-string","table-column-group"),
  Array("fixed-string","table-column"),
  Array("fixed-string","table-cell"),
  Array("fixed-string","table-caption"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["elevation"] = Array(
  Array("string","(angle)"),
  Array("fixed-string","below"),
  Array("fixed-string","above"),
  Array("fixed-string","higher"),
  Array("fixed-string","lower"),
  Array("fixed-string","level"),
  Array("fixed-string","inherit")
  );
  pr["empty-cells"] = Array(
  Array("fixed-string","show"),
  Array("fixed-string","hide"),
  Array("fixed-string","inherit")
  );
  pr["float"] = Array(
  Array("fixed-string","left"),
  Array("fixed-string","right"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["font"] = Array(
  Array("string","(font)"),
  Array("fixed-string","caption"),
  Array("fixed-string","icon "),
  Array("fixed-string","menu"),
  Array("fixed-string","message-box"),
  Array("fixed-string","small-caption"),
  Array("fixed-string","status-bar"),
  Array("fixed-string","inherit")
  );
  pr["font-family"] = Array(
  Array("string","(font-family)"),
  Array("fixed-string","inherit"),
  Array("fixed-string",'Georgia'),
  Array("fixed-string",'serif'),
  Array("fixed-string",'Georgia'),
  Array("fixed-string",'Impact'),
  Array("fixed-string",'Courier New'),
  Array("fixed-string",'Verdana'),
  Array("fixed-string",'Times New Roman'),
  Array("fixed-string",'Courier'),
  Array("fixed-string",'Trebuchet MS'),
  Array("fixed-string",'Arial'),
  Array("fixed-string",'Charcoal'),
  Array("fixed-string",'Chicago'),
  Array("fixed-string",'Comic Sans MS'),
  Array("fixed-string",'Geneva'),
  Array("fixed-string",'Helvetica'),
  Array("fixed-string",'Monaco'),
  Array("fixed-string",'Monotype.com'),
  Array("fixed-string",'Palatino'),
  Array("fixed-string",'Avant Garde'),
  Array("fixed-string",'Arial Black'),
  Array("fixed-string",'Times'),
  Array("fixed-string",'Georgia')
  );
  pr["font-size"] = Array(
  Array("string","(font-size)"),
  Array("fixed-string","inherit")
  );
  pr["font-size-adjust"] = Array(
  Array("string","(integer)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["font-stretch"] = Array(
  Array("fixed-string","normal"),
  Array("fixed-string","wider"),
  Array("fixed-string","ultra-condensed"),
  Array("fixed-string","extra-condensed"),
  Array("fixed-string","condensed"),
  Array("fixed-string","semi-condensed"),
  Array("fixed-string","semi-expanded"),
  Array("fixed-string","expanded"),
  Array("fixed-string","extra-expanded"),
  Array("fixed-string","ultra-expanded"),
  Array("fixed-string","inherit")
  );
  pr["font-style"] = Array(
  Array("fixed-string","normal"),
  Array("fixed-string","italic"),
  Array("fixed-string","oblique"),
  Array("fixed-string","inherit")
  );
  pr["font-variant"] = Array(
  Array("fixed-string","normal"),
  Array("fixed-string","small-caps"),
  Array("fixed-string","inherit")
  );
  pr["font-weight"] = Array(
  Array("fixed-string","normal"),
  Array("fixed-string","bold"),
  Array("fixed-string","bolder"),
  Array("fixed-string","lighter"),
  Array("fixed-string","100"),
  Array("fixed-string","200"),
  Array("fixed-string","300"),
  Array("fixed-string","400"),
  Array("fixed-string","500"),
  Array("fixed-string","600"),
  Array("fixed-string","700"),
  Array("fixed-string","800"),
  Array("fixed-string","900"),
  Array("fixed-string","inherit")
  );
  pr["height"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  );
  pr["left"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  ); 
  pr["letter-spacing"] = Array(
  Array("string","(length)"),
  Array("fixed-string","inherit")
  );
  pr["line-height"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","normal"),
  Array("fixed-string","inherit")
  );
  pr["list-style"] = Array(
  Array("string","(list-style)"),
  Array("fixed-string","inherit")
  );
  pr["list-style-image"] = Array(
  Array("string","(uri)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["list-style-position"] = Array(
  Array("fixed-string","inside"),
  Array("fixed-string","outside"),
  Array("fixed-string","inherit")
  );
  pr["list-style-type"] = Array(
  Array("fixed-string","none"),
  Array("fixed-string","disc"),
  Array("fixed-string","circle"),
  Array("fixed-string","square"),
  Array("fixed-string","decimal"),
  Array("fixed-string","decimal-leading-zero"),
  Array("fixed-string","lower-roman"),
  Array("fixed-string","upper-roman"),
  Array("fixed-string","lower-greek"),
  Array("fixed-string","lower-alpha"),
  Array("fixed-string","lower-latin"),
  Array("fixed-string","upper-alpha"),
  Array("fixed-string","upper-latin"),
  Array("fixed-string","hebrew"),
  Array("fixed-string","armenian"),
  Array("fixed-string","georgian"),
  Array("fixed-string","cjk-ideographic"),
  Array("fixed-string","hiragana"),
  Array("fixed-string","katakana"),
  Array("fixed-string","hiragana-iroha"),
  Array("fixed-string","katakana-iroha"),
  Array("fixed-string","inherit")
  );
  pr["margin"] = Array(
  Array("prg","_dim _dim _dim _dim")
  );
  pr["margin-top"] = Array(
  Array("prg","_dim")
  );
  pr["margin-right"] = 'margin-top';
  pr["margin-bottom"] = 'margin-top';
  pr["margin-left"] = 'margin-top';
  pr["marker-offset"] = Array(
  Array("string","(length)"),
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  );
  pr["marks"] = Array(
  Array("fixed-string","crop"),
  Array("fixed-string","cross"),
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  );
  pr["max-height"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["max-width"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["min-height"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","inherit")
  );
  pr["min-width"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","inherit")
  );
  pr["orphans"] = Array(
  Array("string","(integer)"),
  Array("fixed-string","inherit")
  );
  pr["outline"] = Array(
  Array("string","(outline)"),
  Array("fixed-string","invert"),
  Array("fixed-string","inherit")
  );
  pr["outline-color"] = Array(
  Array("prg","(color)")
  //Array("string","(color)"),
  //Array("fixed-string","invert"),
  //Array("fixed-string","inherit")
  );
  pr["outline-style"] = Array(
  Array("fixed-string","none"),
  Array("fixed-string","hidden"),
  Array("fixed-string","dotted"),
  Array("fixed-string","dashed"),
  Array("fixed-string","solid"),
  Array("fixed-string","double"),
  Array("fixed-string","groove"),
  Array("fixed-string","ridge"),
  Array("fixed-string","inset"),
  Array("fixed-string","outset"),
  Array("fixed-string","inherit")
  );
  pr["outline-width"] = Array(
  Array("string","(border-width)"),
  Array("fixed-string","inherit")
  );
  pr["overflow"] = Array(
  Array("fixed-string","visible"),
  Array("fixed-string","hidden"),
  Array("fixed-string","scroll"),
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  );
  pr["padding"] = Array(
  Array("prg","_dim _dim _dim _dim"),
  Array("fixed-string","inherit")
  );
  pr["padding-top"] = Array(
  Array("prg","_dim")
  );
  pr["padding-right"] = 'padding-top';
  pr["padding-bottom"] = 'padding-top';
  pr["padding-left"] = 'padding-top';
  pr["page"] = Array(
  Array("string","(identifier)"),
  Array("fixed-string","auto")
  );
  pr["page-break-after"] = Array(
  Array("fixed-string","auto"),
  Array("fixed-string","always"),
  Array("fixed-string","avoid"),
  Array("fixed-string","left"),
  Array("fixed-string","right"),
  Array("fixed-string","inherit")
  );
  pr["page-break-before"] = Array(
  Array("fixed-string","auto"),
  Array("fixed-string","always"),
  Array("fixed-string","avoid"),
  Array("fixed-string","left"),
  Array("fixed-string","right"),
  Array("fixed-string","inherit")
  );
  pr["page-break-inside"] = Array(
  Array("fixed-string","avoid"),
  Array("fixed-string","auto")
  );
  pr["pause"] = Array(
  Array("string","(pause)"),
  Array("string","(percentage)"),
  Array("fixed-string","inherit")
  );
  pr["pause-after"] = Array(
  Array("string","(pause)"),
  Array("string","(percentage)"),
  Array("fixed-string","inherit")
  );
  pr["pause-before"] = Array(
  Array("string","(pause)"),
  Array("string","(percentage)"),
  Array("fixed-string","inherit")
  );
  pr["pitch"] = Array(
  Array("string","(frequency)"),
  Array("fixed-string","x-low"),
  Array("fixed-string","low"),
  Array("fixed-string","medium"),
  Array("fixed-string","high"),
  Array("fixed-string","x-high"),
  Array("fixed-string","inherit")
  );
  pr["pitch-range"] = Array(
  Array("string","(number)"),
  Array("fixed-string","inherit")
  );
  pr["play-during"] = Array(
  Array("string","(play-during)"),
  Array("fixed-string","auto"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["position"] = Array(
  Array("fixed-string","static"),
  Array("fixed-string","relative"),
  Array("fixed-string","absolute"),
  Array("fixed-string","fixed"),
  Array("fixed-string","inherit")
  );
  pr["quotes"] = Array(
  Array("string","(quotes)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["richness"] = Array(
  Array("string","(number)"),
  Array("fixed-string","inherit")
  );
  pr["right"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  );
  pr["size"] = Array(
  Array("string","(size-length)"),
  Array("fixed-string","auto"),
  Array("fixed-string","portrait"),
  Array("fixed-string","landscape"),
  Array("fixed-string","inherit")
  );
  pr["speak"] = Array(
  Array("fixed-string","normal"),
  Array("fixed-string","none"),
  Array("fixed-string","spell-out"),
  Array("fixed-string","inherit")
  );
  pr["speak-header"] = Array(
  Array("fixed-string","once"),
  Array("fixed-string","always"),
  Array("fixed-string","inherit")
  );
  pr["speak-numeral"] = Array(
  Array("fixed-string","digits"),
  Array("fixed-string","continuous"),
  Array("fixed-string","inherit")
  );
  pr["speak-punctuation"] = Array(
  Array("fixed-string","code"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["speech-rate"] = Array(
  Array("string","(number)"),
  Array("fixed-string","x-slow"),
  Array("fixed-string","slow"),
  Array("fixed-string","medium"),
  Array("fixed-string","fast"),
  Array("fixed-string","x-fast"),
  Array("fixed-string","faster"),
  Array("fixed-string","slower"),
  Array("fixed-string","inherit")
  );
  pr["stress"] = Array(
  Array("string","(number)"),
  Array("fixed-string","inherit")
  );
  pr["table-layout"] = Array(
  Array("fixed-string","auto"),
  Array("fixed-string","fixed"),
  Array("fixed-string","inherit")
  );
  pr["text-align"] = Array(
  Array("string","(string)"),
  Array("fixed-string","left"),
  Array("fixed-string","right"),
  Array("fixed-string","center"),
  Array("fixed-string","justify"),
  Array("fixed-string","inherit")
  );
  pr["text-decoration"] = Array(
  Array("fixed-string","none"),
  Array("fixed-string","underline"),
  Array("fixed-string","overline"),
  Array("fixed-string","line-through"),
  Array("fixed-string","blink"),
  Array("fixed-string","inherit")
  );
  pr["text-indent"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","inherit")
  );
  pr["text-shadow"] = Array(
  Array("fixed-string","(text-shadow)"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["text-transform"] = Array(
  Array("fixed-string","capitalize"),
  Array("fixed-string","uppercase"),
  Array("fixed-string","lowercase"),
  Array("fixed-string","none"),
  Array("fixed-string","inherit")
  );
  pr["top"] = Array(
  Array("fixed-string","(percentage-length)"),
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  );
  pr["unicode-bidi"] = Array(
  Array("fixed-string","normal"),
  Array("fixed-string","embed"),
  Array("fixed-string","bidi-override"),
  Array("fixed-string","inherit")
  );
  pr["vertical-align"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","baseline"),
  Array("fixed-string","sub"),
  Array("fixed-string","super"),
  Array("fixed-string","top"),
  Array("fixed-string","text-top"),
  Array("fixed-string","middle"),
  Array("fixed-string","bottom"),
  Array("fixed-string","text-bottom"),
  Array("fixed-string","inherit")
  );
  pr["visibility"] = Array(
  Array("fixed-string","visible"),
  Array("fixed-string","hidden"),
  Array("fixed-string","collapse"),
  Array("fixed-string","inherit")
  );
  pr["voice-family"] = Array(
  Array("string","(voice-family)"),
  Array("fixed-string","inherit")
  );
  pr["volume"] = Array(
  Array("string","(number)"),
  Array("string","(percentage)"),
  Array("fixed-string","silent"),
  Array("fixed-string","x-soft"),
  Array("fixed-string","soft"),
  Array("fixed-string","medium"),
  Array("fixed-string","loud"),
  Array("fixed-string","x-loud"),
  Array("fixed-string","inherit")
  );
  pr["white-space"] = Array(
  Array("fixed-string","normal"),
  Array("fixed-string","pre"),
  Array("fixed-string","nowrap"),
  Array("fixed-string","inherit")
  );
  pr["widows"] = Array(
  Array("string","(integer)"),
  Array("fixed-string","inherit")
  );
  pr["width"] = Array(
  Array("string","(percentage-length)"),
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  );
  pr["word-spacing"] = Array(
  Array("string","(length)"),
  Array("fixed-string","normal"),
  Array("fixed-string","inherit")
  );
  pr["z-index"] = Array(
  Array("string","(integer)"),
  Array("fixed-string","auto"),
  Array("fixed-string","inherit")
  );
 //fim prop possíveis
}
//fim navCSS

//*********************************
function paletaCores(nom) {
 var nome = nom;
 var inc = 64;
 var iinc = 16;
 var pp = new Array(64,128,192,256);
 var tp = pp.length;
 var tl = 16;
 var ucor = 'FFFFFF';
 this.scor = ucor;
 var uR=pp,uG=pp,uB=pp;
 var v = new Array();
 var doc = document;
 //alert(doc);
 this.sel = sel;
 this.monta = monta;
 this.montaPag = montaPag;
 this.sCor = sCor;
 this.vCor = vCor;
 this.reset = reset;
 this.inc = mInc;
 //*********************************
 function sel(ev) {
  this.scor = ucor;
  if (ev.ctrlKey) return;
  if (vazio(this.selExec)) {
   alert("COR: "+ucor);
   return;
  }
  //alert(this.selExec+"'"+ucor+"') "+opener);
  eval(this.selExec+"'#"+ucor+"')");
  window.close();
 }
 //*********************************
 function pinta(r,g,b) {
  if (typeof(r)=='undefined') {
   r = pal(ucor.substring(0,2));
   g = pal(ucor.substring(2,4));
   b = pal(ucor.substring(4,6));
  }
  if (typeof(g)=='undefined') {
   g = r;
   b = r;
  }
  for (var i=0;i<r.length;i++){
   for (var j=0;j<g.length;j++) {
    for (var k=0;k<b.length;k++) {
     var p = 'c'+i+''+j+''+k;
     if (r[i]<0 || r[i]>256 ||
      g[j]<0 || g[j]>256 ||
      b[k]<0 || b[k]>256) {
       getId(p).style.background = '#FFFFFF';
       v[p] = '';
      } else {
       var cr = hexRgb(r[i],g[j],b[k]);
       getId(p,this.win).style.background = '#'+cr;
       v[p] = 'c'+cr;
      }
    }
   }
  }
  uR = r;uG = g;uB = b;
  det();
 }
 //*********************************
 function mInc(d) {
  if (d==1) {
   inc = inc==64?inc:inc+iinc;
  } else {
   inc = inc==iinc?inc:inc-iinc;
  }
  pinta();
 }
 //*********************************
 function reset() {
  inc = 64;
  pinta(pp,pp,pp);
 }
 //*********************************
 function montaPag() {
  return '<html><script language="JavaScript" src="/jsCSSEditor.js">'
   +'<LINK REL="StyleSheet" HREF="/jsCSSEditor.css">'
   +'<body onclick=jsCSSEditor(this,event);>'+this.monta()+
   +"</body></html>";
 }
 //*********************************
 function monta() {
  var rt = '<table id=tabR class=pal>'
  +'<tr><td class=palCtrl colspan='+tl+'>'
  +'<input class=palR type=button onClick='
  +nome+'.reset(); value=Reset>'
  +' <input class=palD type=button onClick='
  +nome+'.inc(-1); value="<-inc">'
  +' <input class=palI type=button onClick='
  +nome+'.inc(+1); value="inc->">'
  ;
  var nc=0;
  for (i=0;i<tp;i++){
   for (j=0;j<tp;j++) {
    for (k=0;k<tp;k++) {
     if (nc++%tl==0) rt += "<tr>";
     var p = 'c'+i+''+j+''+k;
     var cr = hexRgb(pp[i],pp[j],pp[k]);
     v[p] = 'c'+cr;
     rt += '<td class=pal id='+p+' bgcolor="#'+cr+'"' 
     + ' onclick='+nome+'.sCor("'+p+'",document);'
     + ' onmouseover='+nome+'.vCor("'+p+'",document);'
     + '>&nbsp;&nbsp;&nbsp;&nbsp;'
     ;
    }
   }
  }
  //cinza
  for (k=256-8;k>-1;k-=8) {
   if (nc++%tl==0) rt += "<tr>";
   var cr = hexRgb(k,k,k);
   var p = 'z'+k;
   v[p] = 'c'+cr;
   rt += '<td class=pal bgcolor="#'+ cr +'"' 
   + ' onclick='+nome+'.sCor("'+p+'");'
   + ' onmouseover='+nome+'.vCor("'+p+'",document);'
   + '>&nbsp;&nbsp;&nbsp;&nbsp;'
   ;
  }
  
  //cores personalizadas
  var c = janLocObj("oCSS").coresP();
  //rt += '<tr><td colspan=10>Cores Personalizadas';
  rt += '<tr><td class=palP colspan='+tl+'><table align=center class=palP>';
  nc=0;
  for (prop in c) {
   var cr = prop.substring(1);
   if (nc++%tl==0) rt += "<tr>";
   var p = 'p'+cr;
   v[p] = 'c'+cr;
   rt += '<td class=pal bgcolor="#'+ cr +'"' 
   + ' onclick='+nome+'.sCor("'+p+'");'
   + ' onmouseover='+nome+'.vCor("'+p+'",document);'
   + '>&nbsp;&nbsp;&nbsp;&nbsp;'
  }
  rt += '</table>';
  
  //alert('c='+this.scor);
  return rt+'<tr>'
  +'<td class=palVer id=cor colspan='+(tl/2)+'>'+det()
  //+'<td onclick=\'alert("COLOR: "+'+nome+'.ucor);\' '
  +'<td onclick='+nome+'.sel(event); '
  +'class=palOK id=scor colspan='+(tl/2)
  +' style="background: #'+this.scor+';"'
  +'><input type=button value=OK class=OK>'
  +'</table>';
 }
 //*********************************
 function pal(b) {
  var a = hexDec(b);
  a = a==255?256:a;
  var ini = a-(tp-1)/2*inc;
  var fim = a+(tp-1)/2*inc;
  if (ini<0) {
   ini = 0;
  } else if (fim>256) {
   ini -=  (fim-256);
  }
  var r = Array(tp);
  for (var i=0;i<tp;i++) {
   r[i] = ini+i*inc;
  }
  //alert(b+'='+a+'='+r);
  return r.sort(
  function(a,b) {
   if (a==b) return 0;
   if (a<b) return -1;
  }
  );
 }
 //*********************************
 function vCor(p,docD) {
  if (!vazio(docD)) {
   doc = docD;
  }
  var cor = v[p].substring(1);
  getId("cor").style.background = '#'+cor;
 }
 //*********************************
 function sCor(p) {
  ucor = v[p].substring(1);
  this.ucor = ucor;
  var od = getId('scor');
  od.style.background = '#'+ucor;
  od.style.color = '#'+corI(ucor);
  if (typeof(ucor)=='undefined' || ucor.length!=6) {
   alert('p='+p+'='+ucor);
   return;
  }
  var cori = ucor.substring(0,2)==ucor.substring(2,4)
  && ucor.substring(2,4)==ucor.substring(4,6);
  if (inc!=16) inc -= 16;
  pinta();
 }
 //*********************************
 function getId(s) {
  return browse.getId(s,doc);
 }
 //*********************************
 function det() {
  var od=getId("cor");
  var r=ucor+' inc='+inc+'<br>R='+uR+'<br>G='+uG+'<br>B='+uB;
  if (objLen(od)!=0) {
   od.style.background="#"+ucor;
   od.style.color="#"+corI(ucor);
   od.innerHTML=r;
  }
  return r; 
 }
 //*********************************
 function corI(a) {
  return hexRgb(
  128+hexDec(a.substring(0,2)),
  128+hexDec(a.substring(2,4)),
  128+hexDec(a.substring(4,6))
  );
 }
 //*********************************
 function hexDec(a) {
  var t='0123456789ABCDEF';
  return t.indexOf(a.substring(0,1))*16+t.indexOf(a.substring(1,2));
 }
}


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

 //*****************************************
 function substrAtAt(g,a,b) {
  return leftAt(substrAt(g,a),b);
 }
 //*****************************************
 function substrAt(g,a) {
  var i = g.indexOf(a);
  if (i<0) return g;
  return g.substring(i+a.length);
 }
 //*******************************//
 function resize(sObj,percX,percY) {
  var ob = browse.getId(sObj);
  if (vazio(ob)) {
   //alert('erro no resize '+sObj);
  }
  var tX=ob.offsetWidth+50,tY=ob.offsetHeight+40;
  if (typeof(percX)=='undefined') percX=90;
  var mX = browse.tamWinX(janRaiz());
  tX = tX>mX?mX:tX;
  if (typeof(percY)=='undefined') percY=90;
  var mY = browse.tamWinY(janRaiz());
  tY = tY>mY?mY:tY;
  try {
   top.resizeTo(tX,tY);
  } catch (e) {
   //alert('ERRO: resize win='+e);
  }
 }
 //*******************************//
 function vazio(a) {
  if (typeof(a)=='object') {
   return objLen(a)==0;
  } else {
   return nulo(a) || a=='' || (typeof(a)=='string' && trimm(a)=='');
  }
 }
 //**************************//
 function hexRgb(r,g,b) {
  return ''+hex1(r)+''+hex1(g)+''+hex1(b);
 }
 //**************************//
 function hex1(c) {
  if (c==256) return 'FF';
  while (c<0) c += 256;
  while (c>256) c -= 256;
  return ''+hex0(Math.floor(c / 16))+''+hex0(c % 16);
 }
 //**************************//
 function hex0(n) {
  return "0123456789ABCDEF".substring(n,n+1);
 }
 //**************************//
 function objLen(o){
  var i=0;
  for(var prop in o) {
   i++;
  }
  return i;
 }
 //*********************************
 function janRaiz() {
  if (vazio(top.opener)) {
   return top;
  }
  return top.opener.janRaiz();
 }
 //**************************//
 function leftAt(s,s1) {
  var p = s.indexOf(s1);
  if (p==-1) {
   return s;
  }
  return s.substring(0,p);
 }
 //**********************
 function trocaTudo(g,a,b) {
  var n;
  while ((n=troca(g,a,b))!=g) {
   g = n;
  }
  return g;
 }
 //**********************
 function troca(g,a,b) {
  var i=0,p,ta,tb;
  
  ta = a.length;
  tb = b.length;
  
  while ( (p = g.indexOf(a,i)) > -1 )  {
   g = g.substring(0,p)+b+g.substring(p+ta);
   //,g.length
   i = p - ta + tb + 1;
  }
  
  return g;
 }
 //**************************//
 function palavraA(tx,a,b) {
  var r = new Array,p;
  while ((p=tx.indexOf(a))!=-1) {
   r[r.length] = tx.substring(0,p);
   tx = tx.substring(p+a.length);
  }
  r[r.length] = tx;
  if (nulo(b)) {
   return r;
  }
  for (var i=0;i<r.length;i++) {
   r[i] = palavraA(r[i],b);
  }
  return r;
 }
 //**************************************
 function trimm(a,b) {
  var i,t;
  if (typeof(b)=='undefined') {
   b = ' \n\r\t';
  }
  //retira do inicio
  t = a.length-1;
  if (t<0) return a;
  i = 0;
  while (i<t & b.indexOf(a.substring(i,i+1))>-1) i++;
  if (i!=0) a = a.substring(i,t+1);
  //retira do fim
  t = a.length;
  if (t<1) return a;
  i = t-1;
  while (i>-1 && b.indexOf(a.substring(i,i+1))>-1) i--;
  if (i!=t-1) a = a.substring(0,i+1);
  return a;
 }
 //*******************************//
 function nulo(a) {
  return (a==null || typeof(a)=='undefined');
 }
 //*********************************
 function janLocObj(nome) {
  var x;
  try {
   x = eval(nome);
  } catch (e) {
  }
  if (typeof(x)!='undefined') {
   return x;
  }
  if (vazio(top.opener)) {
   return null;
  }
  return top.opener.janLocObj(nome);
 }
 

 
 //********************************
 //********************************
 function winDep(jan,url) {
  this.debug=false;
  this.jan = jan;
  this.url = url;
  this.tipo = 0;
  this.cascata = false;
  this.nome = '_blank';
  this.obj = null;
  this.pulaClose = false;
  this.janPos = -1;
  this.frame=false;
  this.centrada = true;
  this.scr = 'yes'; //scroll
  
  this.w = 400;
  this.h = 400;
  
  this.abre = winDep_abre;
  this.centra = winDep_centra;
  this.on = winDep_on;
  this.fCascata = fCascata;
  this.html = html;
  //********************************
  function html(txH) {
   this.obj.innerHTML = txH;
  }
  //********************************
  function winDep_on(s) {
   if (this.frame) {
    //alert('não sei gravar em frame...');
    var d = browse.getId('frm',this.obj.document);
    //objNav(d);
    d.contentWindow.document.write(s);
   } else {
    this.obj.document.write(s);
   }
  }
  //********************************
  function winDep_centra() {
   if (browse.ie) {
    this.pX = this.jan.screenLeft+this.jan.document.body.offsetWidth/2
    -this.w/2;
    this.pY = this.jan.screenTop+this.jan.document.body.offsetHeight/2
    -this.h/2;
   } else {
    this.pX = this.jan.screenX+this.jan.outerWidth/2-this.w/2;
    this.pY = this.jan.screenY+this.jan.outerHeight/2-this.h/2;
   }
  }
  //********************************
  function fCascata() {
   if (browse.ie) {
    this.pX = this.jan.screenLeft+20;
    this.pY = this.jan.screenTop+30;
   } else {
    this.pX = this.jan.screenX+20;
    this.pY = this.jan.screenY+30;
   }
  }
  //********************************
  function winDep_abre() {
   if (existeWin(this.url)) {
    //alert('url existe='+url);
    return false;
   }
   if (this.centrada) {
    this.centra();
   }
   if (this.cascata) {
    this.fCascata();
   }
   //alert('x='+this.pX+' y='+this.pY);
   var d=this.debug?"yes":"no";
   var t='width='+this.w+',height='+this.h
   +(this.pX?',screenX='+this.pX+',screenY='+this.pY:'')
   +',resizable=yes,scrollbars='+this.scr+','
   +'toolbar='+d+',menubar='+d+',status='+d;
   //alert(t);
   if (this.frame) {
    this.obj = window.open('',this.nome,t);
   } else {
    this.obj = window.open(this.url,this.nome,t);
   }
   //alert('ab');
   try {
    this.obj.focus();
    if (this.tipo!=3) {
     registraWin(this);
    }
    if (this.frame) {
     this.obj.document.write(
     '<html><frameset rows=100% border=1 framespacing=1 frameborder=0>'
     +'<frame id=frm src="'+this.url+'"></frameset></html>'
     );
    }
   } catch(e) {
   }
   return true;
  }
 }
//fim CTRLE JAN DEPENDENTES
//*******************************//
//*******************************//
//*******************************//
// CONTROLE DE JANELAS POPUP..
// TIPOS DE JANELA: 
// 0 - FECHA SÓ SE FECHAR A PRINCIPAL
// 1 - FECHA SE O FOCO VOLTAR A PRINCIPAL
// 2 - OBRIGA O FOCO NA SECUNDARIA (DIÁLOGO);
// 3 - TOTALMENTE INDEPENDENTE
//*******************************//
//*******************************//
//*******************************//
var wDep = new Array,wTip = new Array,wUrl = new Array;
var parente,objPai;
var obj_obj;
//*******************************//
 function objParente() {
  return obj_obj;
 }
 
 //*******************************//
 var acoesEvento = new Array(); 
 //*******************************//
 function regAcaoEvento(acao,funct) {
  if (vazio(acoesEvento[acao])) {
   acoesEvento[acao] = new Array();
  }
  acoesEvento[acao][acoesEvento[acao].length] = funct;
 }
 //*******************************//
 function evento(s,ev) {
  //executa acoes registradas
  if (!vazio(acoesEvento[s])) {
   for (prop in acoesEvento[s]) {
    //alert(prop);
    eval(acoesEvento[s][prop]+'()');
   }
  }
  
  if (s=='resize') {
  }
  if (s=='load') {
   //alert('l='+opener);
   if (objLen(opener)!=0) {
    parente = opener;
    objPai = opener.objParente();
   }
   //objLen(opener);
   if (!vazio(objPai) && !vazio(objPai.onLoad)) {
    eval(objPai.onLoad);
   }
  }
  if (s=='close') {
   if (!vazio(objPai) && objPai.pulaClose) {
    objPai.pulaClose = false;
    return;
   }
   //fecha todas as janelas dependentes
   for (i=0;i<wDep.length;i++) {
    if (wDep[i]!=0) {
     wDep[i].close();
     wDep[i] = 0;
    }
   }
   //informa a superior
   if (parente && !vazio(objPai)) {
    //alert('informa sup');
    parente.dRegistraWin(objPai.janPos);
   }
  }
  if (s=='focus') {
   //fecha janelas tipo 1 
   for (i=0;i<wDep.length;i++) {
    if (wDep[i]!=0 && wTip[i]==1) {
     wDep[i].close();
     wDep[i] = 0;
    } else if (wDep[i]!=0 && wTip[i]==2) {
     try {
      wDep[i].focus();
     } catch(e) {
      //alert('Erro: '+e);
     }
    }
   }
  }
  if (s=='focusOut') {
   if (!vazio(objPai) && objPai.tipo==2) {
    //window.focus();
    //alert("tipo janela=1");
    //fecha somente se o foco volta para a mãe...
    //parente.dRegistraWin(janPos);
    //window.close();
   }
  }
 }
 //*******************************//
 function dRegistraWin(i) {
  if (typeof(i)=='string') {
   i = substrAt(i,'//');
   i = '/'+substrAt(i,'/');
   for (var i1=0;i1<wDep.length;i1++) {
    if (wDep[i1]!=0 && wUrl[i1]==i) {
     //alert('achei: '+wUrl[i1]);
     dRegistraWin(i1);
     return;
    }
   }
   alert('not found: '+i+'\nem\n'+wUrl);
  } else if (wDep[i]!=0) {
   wDep[i].close();
   wDep[i] = 0;
  }
 }
 //*******************************//
 function existeWin(url) {
  for (var i=0;i<wDep.length;i++) {
   if (wDep[i]!=0 && wUrl[i]==url) {
    try {
     wDep[i].document.write('');
     wDep[i].focus();
    } catch(e) {
     //alert('e='+e);
     wDep[i]=0;
     return false;
    }
    return true;
   }
  }
 }
 
 //*******************************//
 function registraWin(obj) {
  for (i=0;i<wDep.length;i++) {
   if (wDep[i]==0) {
    break;
   }
  }
  obj.janPos = i;
  wDep[i] = obj.obj;
  wTip[i] = obj.tipo;
  wUrl[i] = obj.url;
  obj_obj = obj;
 }
 //*******************************//
 function resize(sObj,percX,percY) {
  var ob = browse.getId(sObj);
  if (vazio(ob)) {
   //alert('erro no resize '+sObj);
   return;
  }
  var tX=ob.offsetWidth+50,tY=ob.offsetHeight+40;
  if (typeof(percX)=='undefined') percX=90;
  var mX = browse.tamWinX(janRaiz());
  tX = tX>mX?mX:tX;
  if (typeof(percY)=='undefined') percY=90;
  var mY = browse.tamWinY(janRaiz());
  tY = tY>mY?mY:tY;
  try {
   top.resizeTo(tX,tY);
  } catch (e) {
   //alert('ERRO: resize win='+e);
  }
 }
 //*******************************//
 function centra(ob,noOb) {
  var xy = centraCoo(ob,noOb);
  if (xy.length>1) {
   //alert(xy);
   ob.moveTo(xy[0],xy[1]);
  }
 }
 //*******************************//
 function centraCoo(ob,noOb) {
  if (!cli.centra) return;
  if (typeof(noOb)=='undefined') {
   noOb = ob;
   ob = top;
  }
  if (browse.ie) {
   try {
    var pX = noOb.screenLeft+noOb.document.body.offsetWidth/2
    -ob.document.body.offsetWidth/2;
    var pY = noOb.screenTop+noOb.document.body.offsetHeight/2
    -ob.document.body.offsetHeight/2;
    return new Array(pX,pY);
   } catch (e) {
    alert('error='+e);
   }
  } else {
   var pX = noOb.screenX+noOb.outerWidth/2-ob.outerWidth/2;
   var pY = noOb.screenY+noOb.outerHeight/2-ob.outerHeight/2;
   return new Array(pX,pY);
  }
  return new Array();
 }
 

//**************************//
//**************************//
var browse = new mznsie();
//**************************//
//**************************//
function mznsie() {
 this.NS6 = false;
 this.NS4 = false;
 this.IE4 = false;
 //alert(navigator.appName+'\n'+navigator.appVersion);
 if (document.getElementById && !document.all) {
  this.NS6 = true;
  this.nav = "NS6";
 } else {
  if (document.layers) {
   this.NS4 = true;
   this.nav = "NS4";
  } else {
   if (document.all) {
    this.IE4 = true;
    this.nav = "IE4";
    this.IE6 = navigator.appVersion.indexOf('MSIE 6')!=-1;
   }
  }
 }
 this.ie = this.IE4;
 this.moz = this.IE6;	
 
 var x = new Array("getId","mostra","esconde","getAbsX","getAbsY"
 ,"setX","setY","getX","getY","getTX","getTY","getDocFrame"
 ,"visivel","eventoX","eventoY","tamWinX","tamWinY");
 for (var i=0;i<x.length;i++) {
  this[x[i]] = eval('obj_'+x[i]+this.nav);
 }
 //alert("obj criado"+this);
 //alert("obj criado"+this.getId);
 
 //**************************//
 //campos uso geral
 //**************************//
 this.MostraEsconde = obj_MostraEsconde;
 
 function obj_MostraEsconde(id) {
  var o = this.getId(id);
  if (this.visivel(o)) {
   this.esconde(o);
  } else {
   this.mostra(o);
  }
 }
 //**************************//
 function obj_tamWinXNS6(o) {
  if (vazio(o)) {
   o = window;
  }
  return o.outerWidth;
 }
 function obj_tamWinXIE4(o) {
  if (vazio(o)) {
   o = window;
  }
  return o.document.body.offsetWidth;
 }
 //**************************//
 function obj_tamWinYNS6(o) {
  if (vazio(o)) {
   o = window;
  }
  return o.outerHeight;
 }
 function obj_tamWinYIE4(o) {
  if (vazio(o)) {
   o = window;
  }
  return o.document.body.offsetHeight;
 }
 //**************************//
 function obj_eventoYNS6(o) {
  //alert(o.offsetWidth);
  return o.layerY;
 }
 function obj_eventoYNS4(o) {
  return o.y;
 }
 function obj_eventoYIE4(o) {
  //alert(o.offsetWidth);
  //return o.clientY+o.offsetY;
  //return o.screenY+o.offsetY;
  return -1;
 }
 //**************************//
 function obj_eventoXNS6(o) {
  //alert(o.offsetWidth);
  return o.layerX;
 }
 function obj_eventoXNS4(o) {
  return o.x;
 }
 function obj_eventoXIE4(o) {
  //alert(o.offsetWidth);
  //return o.clientX+o.offsetX;
  //return o.screenX+o.offsetX;
  return o.clientX;
  return -1;
 }
 //**************************//
 function obj_getTXNS6(o) {
  //alert(o.offsetWidth);
  return o.offsetWidth;
 }
 function obj_getTXNS4(o) {
  return -1;
 }
 function obj_getTXIE4(o) {
  //alert(o.offsetWidth);
  return o.offsetWidth;
 }
 //**************************//
 function obj_getTYNS6(o) {
  return o.offsetHeight;
 }
 function obj_getTYNS4(o) {
  return -1;
 }
 function obj_getTYIE4(o) {
  return o.offsetHeight;
 }
 //**************************//
 function obj_getIdNS6(id,ob) {
  if (typeof(ob)=='undefined') ob = document;
  return ob.getElementById(id);
 }
 function obj_getIdNS4(id) {
  var r = document.layers[id];
  return r;
 }
 function obj_getIdIE4(id) {
  if (typeof(ob)=='undefined') ob = document;
  return ob.all[id];
 }
 
 //**************************//
 function obj_getXNS6(o) {
  return o.style.left;
 }
 function obj_getXNS4(o) {
  return o.x;
 }
 function obj_getXIE4(o) {
  return o.style.pixelLeft;
 }
 //**************************//
 function obj_getYNS6(o) {
  return o.style.top;
 }
 function obj_getYNS4(o) {
  return o.y;
 }
 function obj_getYIE4(o) {
  return o.style.pixelTop;
 }
 //**************************//
 function obj_setXNS6(o,p) {
  o.style.left = p;
 }
 function obj_setXNS4(o,p) {
  o.x = p;
 }
 function obj_setXIE4(o,p) {
  o.style.pixelLeft = p;
 }
 //**************************//
 function obj_setYNS6(o,p) {
  o.style.top = p;
 }
 function obj_setYNS4(o,p) {
  o.y = p;
 }
 function obj_setYIE4(o,p) {
  o.style.pixelTop = p;
 }
 //**************************//
 function obj_visivelNS6(o) {
  return o.style.visibility == "visible";
 }
 function obj_visivelNS4(o) {
  return o.visibility == "show";
 }
 function obj_visivelIE4(o) {
  return o.style.visibility == "visible";
 }
 //**************************//
 function obj_mostraNS6(o,b) {
  o.style.visibility = "visible";
  if (''+b=='undefined') o.style.display = '';
 }
 function obj_mostraNS4(o) {
  o.visibility = "show";
 }
 function obj_mostraIE4(o,b) {
  o.style.visibility = "visible";
  if (''+b=='undefined') o.style.display = '';
 }
 //**************************//
 function obj_escondeNS6(o,b) {
  o.style.visibility = "hidden";
  if (''+b=='undefined') o.style.display = 'none';
 }
 function obj_escondeNS4(o,b) {
  o.visibility = "hide";
 }
 function obj_escondeIE4(o,b) {
  o.style.visibility = "hidden";
  
  if (''+b=='undefined') o.style.display = 'none';
 }
 //**************************//
 function obj_getAbsXNS6(o) {
  var a=o.offsetParent;
  if ((""+a).substring(0,4)=="[obj") {
   // & (""+a).indexOf("HTMLBodyElement")==-1) 
   //rr += "* "+a;
   return o.offsetLeft + obj_getAbsXNS6(a);
  } else {
   return o.offsetLeft;
  }
 }
 function obj_getAbsXNS4(o) {
  return o.x;
 }
 function obj_getAbsXIE4(o) {
  var a=o.offsetParent;
  if ((""+a).substring(0,4)=="[obj") {
   return o.offsetLeft + obj_getAbsXIE4(a);
  } else {
   return o.offsetLeft;
  }
 }
 //**************************//
 function obj_getDocFrameNS6(o) {
  return o.contentDocument;
 }
 //**************************//
 function obj_getDocFrameNS4(o) {
  alert("nao sei getDocFrameNS4");
  return o.contentDocument;
 }
 //**************************//
 function obj_getDocFrameIE4(o) {
  //alert("nao sei getDocFrameIE4"+obj(o.ownerDocument));
  return o.ownerDocument;
 }
 //**************************//
 function obj_getAbsYNS6(o) {
  var a=o.offsetParent;
  if ((""+a).substring(0,4)=="[obj") {
   return o.offsetTop + obj_getAbsYNS6(a);
  } else {
   return o.offsetTop;
  }
 }
 function obj_getAbsYNS4(o) {
  return o.y;
 }
 function obj_getAbsYIE4(o) {
  return obj_getAbsYNS6(o);
 }
}
 //*********************************
 function targetEvent(ev) {
  var v = Array('target','srcElement','originalTarget','currentTarget',
  'explicitOriginalTarget','relatedTarget');
  //localiza obj destino
  for (var i=0;i<v.length;i++) {
   var o = ev[v[i]];
   if (o!=null) {
    try {
     //var r = o.tagName;
     return o;
    } catch (e) {
    }
   }
  }
  return null;
 }


 //**************************//
 //debug
 //**************************//
 function objNav(o) {
  if (typeof(o)=='undefined') {
   this.filtro = o;
   this.o = objNavAlvo;
   //metodos
   this.mostra = mostra;
   this.filtrar = filtrar;
   this.pula = pula;
   this.mItem = mItem;
   this.item = item;
   this.mostra();
  } else {
   init(o);
  }
  //**************************//
  function mItem(prop,z) {
   var r='';
   var t = typeof(z);
   if (t=='function' && (''+z).length>40) {
    z = ''+z;
    z = z.substring(0,40)+'...(+'+z.length+')';
   }
   if (!this.tp[t]) {
    this.tp[t] = 0;
   }
   this.tp[t]++;
   if (!this.filtro || t==this.filtro) {
    r += '<tr><td><font size=2 color=darkgreen><b>'+t+'</b></font> '
    +'<a href=javascript:este.pula("'+prop+'");>'+prop+'</a>: '
    +'<font size=2>'+(t=='string' || t=='function'?html(''+z):z)
    ;
   }
   if (t=='function' && ''+prop=='item') {
    //alert('item...');
    r += this.item();
   }
   return r;
  }
  //**************************//
  function item() {
   //alert('item');
   var r = '';
   for (var i=0;i<this.o.length;i++) {
    r += this.mItem('item_'+i+'',this.o.item(i));
   }
   return r;
  }
  //**************************//
  function pula(o) {
   var ds;
   if (o.substring(0,5)=='item_') {
    ds = this.o.item(1*o.substring(6));
   } else {
    ds = this.o[o];
   }
   objNav(ds);
  }
  //**************************//
  function init(o) {
   var r = '<html>'
   +'<script language="JavaScript" '
   +'src="/js/jan.js"></script>'
   +'<body><table border=1><tr><td>'
   +'<font size=3>Objeto: <font color=red>'+o
   +'<tr><td id=dad>'
   +'</table>'
   +'<scr'+''+'ipt>var este;'
   +' setTimeout("este=new objNav();",100);'
   +'</scr'+''+'ipt>'
   +'</body>'
   +'</html>'
   ;
   var w = window.open('about:blank','_blank',
   'width=600,height=700,resizable=yes,scrollbars=yes,status=0'
   );
   w.document.write(r);
   w.objNavAlvo = o;
  }
  
  //**************************//
  function filtrar(f) {
   if (typeof(f)!='string') {
    alert('filtro por chave');
    return;
   }
   this.filtro = f;
   this.mostra();
  }
  //**************************//
  function mostra() {
   this.tp = new Array;
   var o = this.o;
   var filtro = this.filtro;
   var i=0,z;
   var r = '';
   for(var prop in o) {
    try {
     z = o[prop];
    } catch (e) {
     z = '?erro:'+e;
    }
    r += this.mItem(prop,z);
    i++;
    if (i>200) break;
   }
   //mostra totais por tipo
   var r1 = '<tr><td colspan=2><b>'+i
   +' (limite 200) </b>';
   r1 += '(<b><a href=javascript:este.filtrar("");>'
   +'Todos</a></b>='+i+') ';
   for(var prop in this.tp) {
    var z = this.tp[prop];
    r1 += '(<b><a href=javascript:este.filtrar("'+prop+'");>'
    +prop+'</a></b>='+z+') ';
   }
   r1 += '<br><b>Chave</b>: '
   +'<input size=10 onChange=este.filtrar(this)>';
   r = '<table border=1>'+r1+r+'</table>';
   //var w = window.open('about:blank','_blank',
   // 'width=400,height=700,resizable=yes,scrollbars=yes,status=0'
   //);
   //w.document.write(r);
   var ds=browse.getId('dad');
   ds.innerHTML = r;
   
   return r;
  }
 }


/*
Drag 'n' Drop: JavaScript

function beginDrag(e) { 
  dump("drag start\n"); 
  window.lastX=e.clientX; 
  window.lastY=e.clientY; 
  window.onmousemove=doDrag; 
  window.onmouseup=endDrag; 
} 

function endDrag(e) { 
  dump("drag end\n"); 
  window.onmousemove=null; 
}

#  Pseudo-Klassen
    * :link
    * :visited
    * :active
    * :hover
    * :focus
    * :lang()
    * :first-child
    * :left und :right
    * :first
    * Verknüpfung
#  Pseudo-Elemente
    * :first-letter
    * :first-line
    * :after
    * :before
Inhaltsverzeichnis

von Jan Winkler

    * Einführung
          o Nutzen
          o Entstehung
          o Konzept
          o Unterstützung
          o Zukunft
    * Notation
          o Allgemein
          o CSS und HTML
          o Anweisungen
          o Elemente
          o Elementtypen
          o Eigenschaften
          o Werte
          o Klassifizierungen
          o Kommentare
    * Verknüpfungen
          o Komma
          o Punkt
          o Raute
          o Leerzeichen
          o Stern
          o Größer-Als
          o Plus
          o Attribute
          o Attribut-Wert-Kombination
          o Attribut-Wert-Auswahl
          o Länderdefinition
          o Verknüpfung von Verknüpfungen
    * Pseudo-Klassen
          o :link
          o :visited
          o :active
          o :hover
          o :focus
          o :lang()
          o :first-child
          o :left und :right
          o :first
          o Verknüpfung
    * Pseudo-Elemente
          o :first-letter
          o :first-line
          o :after
          o :before
    * Regeln in CSS
          o Erbschaftsregel (CSS 1)
          o Erbschaftsregel (CSS 2)
          o important-Regel (CSS 1)
          o important-Regel (CSS 2)
    * Aufrufe in CSS
          o @import-Aufruf (CSS 1)
          o @import-Aufruf (CSS 2)
          o @charset-Aufruf
          o @font-face-Aufruf
          o @media-Aufruf
          o @page-Aufruf
    * Schriftgestaltung
          o font-family
          o font-size
          o font-style
          o font-variant
          o font-weight
          o font
          o font-size-adjust
          o font-stretch
    * Schriftdefinition
          o @font-face-Aufruf
          o font-family, font-size, font-stretch, font-style, font-variant und font-weight
          o unicode-range
          o units-per-em
          o src
          o ascent
          o bbox
          o cap-height
          o definition-src
          o descent
          o panose-1
          o slope
          o stemh und stemv
          o widths
          o x-height
          o baseline
          o centerline
          o mathline
          o topline
    * Textgestaltung
          o letter-spacing
          o line-height
          o text-align
          o text-decoration
          o text-indent
          o text-transform
          o vertical-align
          o word-spacing
          o direction
          o text-shadow
          o unicode-bidi
          o white-space
    * Microsoft Texteigenschaften
          o line-break
          o ruby-align
          o ruby-overhang
          o ruby-position
          o text-autospace
          o text-justify
          o text-kashida-space
          o text-underline-position
          o word-break
          o word-wrap
          o writing-mode
    * Farbe und Hintergrundgestaltung
          o color
          o background-attachment
          o background-color
          o background-image
          o background-position
          o background-position-x und background-position-y
          o background-repeat
          o background
    * Box-Eigenschaften
          o padding-top, padding-bottom, padding-left und padding-right
          o padding
          o margin-top, margin-bottom, margin-left und margin-right
          o margin
          o Berechnung von Außenabständen
    * Rahmeneigenschaften
          o border-top-color, border-bottom-color, border-left-color und border-right-color
          o border-color
          o border-top-style, border-bottom-style, border-left-style und border-right-style
          o border-style
          o border-top-width, border-bottom-width, border-left-width und border-right-width
          o border-width
          o border-top, border-bottom, border-left und border-right
          o border
    * Positionierung
          o clear
          o display
          o float
          o height
          o width
          o clip
          o min-height und max-height
          o min-width und max-width
          o top, bottom, left und right
          o overflow
          o overflow-x und overflow-y
          o position
          o visibility
          o z-index
    * Microsoft Layouteigenschaften
          o behavior
          o filter
          o ime-mode
          o layout-grid-char und layout-grid-line
          o layout-grid-mode
          o layout-grid-type
          o layout-grid
          o zoom
    * Inhaltserzeugung
          o content
          o quotes
    * Counter & Listen
          o counter()
          o counter-increment
          o counter-reset
          o list-style-image
          o list-style-position
          o list-style-type
          o list-style
          o marker-offset
    * Seitendefinition
          o @page-Aufruf
          o marks
          o page-break-after und page-break-before
          o page-break-inside
          o page
          o orphans
          o size
          o widows
    * Tabellen
          o border-collapse
          o border-spacing
          o caption-side
          o empty-cells
          o table-layout
          o speak-header
    * Benutzereigenschaften
          o cursor
          o Konturen
          o outline-color
          o outline-style
          o outline-width
          o outline
          o Scrollbars
          o scrollbar-3dlight-color
          o scrollbar-arrow-color
          o scrollbar-base-color
          o scrollbar-darkshadow-color
          o scrollbar-face-color
          o scrollbar-highlight-color
          o scrollbar-shadow-color
    * Aurale Gestaltung
          o azimuth
          o elevation
          o cue-after, cue-before und cue
          o pause-after, pause-before und pause
          o pitch
          o pitch-range
          o play-during
          o richness
          o speak
          o speak-numeral
          o speak-punctuation
          o speech-rate
          o stress
          o voice-family
          o volume
  http://www.html-world.de/program/xml_3.php#kommentareindtds
*/
