function carregaDescendente(id){
$('arv_detalhes').update('Carregando...');
new Ajax.Updater('arv_detalhes', 'http://www.knabben.com.br/_ajax.php?acao=exibeDescendente&id='+id, {
onComplete:function(){
new Effect.Appear('arv_detalhes',{duration: 0.2});
},
evalScripts: true
});
new Ajax.Updater('descendenteUl_'+id, 'http://www.knabben.com.br/_ajax.php?acao=carregaFilhos&id='+id, {
onComplete:function(){
new Effect.Appear('descendenteUl_'+id,{duration: 0.2,afterFinish: function(){
$('descendenteA_'+id).setStyle({'color': '#ff0000'});
$('descendenteLi_'+id).siblings().each(function(_ele){
$(_ele).descendants().each(function(__ele){
$(__ele).setStyle({'color': '#0284C0'});
$(__ele).nextSiblings().each(function(___ele){
new Effect.Fade(___ele,{duration: 0.2});
});
});
});
}});
},
evalScripts: true
});
return false;
}
function buscaDescendente(nome, _div, _dest ){
if(nome.value.length > 3){
if(!$('busca_geral').visible() && _div == 'busca_geral_resultado')
new Effect.Appear('busca_geral');
new Ajax.Updater($( _div ),'http://www.knabben.com.br/_ajax.php?acao=buscaDescendente&nome='+nome.value+"&destino="+_dest, {
evalScripts: true});
}
}
function buscaConjuge(nome, _div, _dest ){
if(nome.value.length > 3){
new Ajax.Updater($( _div ),'http://www.knabben.com.br/_ajax.php?acao=buscaConjuge&nome='+nome.value+"&destino="+_dest, {
evalScripts: true});
}
}
function fieldsetShow(fid){
$('fieldset_'+fid).show();
new Effect.ScrollTo( 'fieldset_'+fid , {offset: -50});
$('aO_'+fid).hide();
$('aC_'+fid).show();
}
function fieldsetHide(fid){
$('fieldset_'+fid).hide();
$('aO_'+fid).show();
$('aC_'+fid).hide();
}
function ajax_insere_campo_arquivo(){
new Insertion.Bottom('fotos','
ArquivoLegenda (coloque o nome das pessoas que aparecem na foto)' );
}
function showEmail( pagTitle, pagUrl ){
if($('photo').visible()){
new Effect.Fade($('emailContent'),{duration: 0.2, afterFinish: function(){
new Effect.Fade($('photo'),{duration: 0.2});
}});
//$('photoContentInner').update('');
}else{
var arrayPageSize = getPageSize();
Element.setHeight('photo', arrayPageSize[1]);
$('photo').toggle();
//Element.setWidth('emailContent', 2*arrayPageSize[2]/3);
//Element.setHeight('emailContent', 2*arrayPageSize[3]/3 ); //3*arrayPageSize[3]/4);
$('emailContent').setStyle({'left': ((arrayPageSize[2]/2)-200)+"px"});
var arrayPageScroll = getPageScroll();
var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
Element.setTop('emailContent', lightboxTop);
$('pagTitle').value = pagTitle;
$('pagView').update(pagTitle);
$('pagUrl').value = pagUrl;
$('emailContent').toggle();
new Effect.Appear('emailContentInner',{duration: 0.2});
}
}
function fadeEmailResponse(){
new Effect.Fade($('emailResponse'),{duration: 1});
}
function submitDivulgue(){
new Ajax.Request('http://www.knabben.com.br/_ajax.php?'+$('formularioForm').serialize(),{
onSuccess: function(transport) {
if(transport.responseText == 'ok'){
new Effect.Fade($('emailContentInner'),{duration: 0.2});
new Effect.Appear($('emailResponse'),{duration: 0.2});
$('emailResponse').update('Consulta enviada com sucesso').setStyle({ background: '#dfd' });
new Effect.Fade($('emailContentInner'),{duration: 0.5});
showEmail();
}else{
$('emailResponse').toggle();
$('emailResponse').update('Não foi possível enviar a sua consulta, tente novamente.').setStyle({ background: '#fdd' });
setTimeout('fadeEmailResponse()',3000)
}
}
});
return false;
}
function popImagem(url,dim){
w = window.open('http://www.knabben.com.br/'+url,"galeria",dim);
w.focus();
}
function popConjuge(id){
if($('photo').visible()){
new Effect.Fade($('conjugeContent'),{duration: 0.2, afterFinish: function(){
new Effect.Fade($('photo'),{duration: 0.2});
}});
$('conjugeContentInner').update('');
}else{
var arrayPageSize = getPageSize();
Element.setHeight('photo', arrayPageSize[1]);
$('photo').toggle();
$('conjugeContent').setStyle({'left': ((arrayPageSize[2]/2)-200)+"px"});
//var arrayPageScroll = getPageScroll();
//var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
Element.setTop('conjugeContent', 100);
$('conjugeContent').toggle();
new Ajax.Updater($('conjugeContentInner'),'http://www.knabben.com.br/_ajax.php?acao=exibeConjuge&id='+id, {
onComplete: function () { new Effect.Appear('conjugeContentInner',{duration: 0.2});
},
evalScripts: true});
}
}
function abre_link(link,w,h){
window.open(link, "grande", 'menubar=no,resizable=no,scrollbars=no,width='+w+',height='+h)
}
function FormataData(Campo,teclapres)
{
var tecla = teclapres.keyCode;
var vr = new String(Campo.value);
vr = vr.replace( ".", "" );
vr = vr.replace( "/", "" );
vr = vr.replace( "/", "" );
tam = vr.length + 1;
if ( tecla != 9 && tecla != 8 )
{
if ( tam > 2 && tam < 5 )
Campo.value = vr.substr( 0, tam - 2 ) + '/' + vr.substr( tam - 2, tam );
if ( tam >= 5 && tam <= 10 )
Campo.value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 );
}
}