var valid; function sendForm(){ if(valid.validate()){ params = $('formularioForm').serialize(); $('formulario').update("Enviando......"); new Ajax.Updater($('formulario'),'http://www.escritacontabilidade.com.br/_ajax.php',{ parameters: params }); } return false; } var fotoAtual = ''; preloadImage = new Image(); function popImagem( _id ){ if( !_id ){ $('emailContentInner').update(''); new Effect.Morph('emailContent',{ style:'width:100px; height:102px; left:-65px; ', duration:0.3, afterFinish: function(){ new Effect.Fade($('emailContent')); } }); }else{ new Effect.Appear($('emailContent')); $('emailContentInner').update('Carregando...').show(); preloadImage.src = 'http://www.escritacontabilidade.com.br/imagem.php?id='+_id+'&width=750&height=400'; preloadImage.onload = function(){ new Effect.Morph('emailContent',{ style:'width:'+preloadImage.width+'px; height:'+preloadImage.height+'px; left:-'+ (preloadImage.width+60)/2 +'px; ', duration:0.3, afterFinish: function(){ var imagem = document.createElement("img"); imagem.setAttribute('src', preloadImage.src); $('emailContentInner').update(imagem); //$('emailContentInner').update(''); } }); }; } fotoAtual = _id; } function menu(_div){ //new Effect.Fade($('overlay'), { duration: 0.3, from: 0.0, to: 0.5, afterFinish: function (){ new Effect.Fade($('conteudo'),{ duration: 0.3, afterFinish:function(){ new Ajax.Request('http://www.escritacontabilidade.com.br/_ajax.php?acao=carregaPagina&pagina=' + _div, { onComplete: function(transport) { $('innerContent').update(transport.responseText); new Effect.Appear($('conteudo'), {duration: 0.3, afterFinish:function(){ //new Effect.Appear($('overlay'), { duration: 0.3, from: 0.0, to: 0.5 }); $('innerContent').setStyle({'top':'10px'}); rolagem(); pageTracker._trackPageview(_div); }}); } }); }}); //}}); } function imprimir( ){ window.print(); } function cadastraNewsletter(){ var email = $('baseNewsEmail').value; $('newsLetterResponse').update("Carregando..."); new Ajax.Updater($('newsLetterResponse'),'http://www.escritacontabilidade.com.br/_ajax.php?acao=cadastraNewsletter&email='+email); } function rolagem(){ if ($('innerContent').getHeight() <= $('conteudo').getHeight()) { $('rolagem').fade(); }else{ $('rolagem').appear(); } } function rolar( dir ){ y = dir == 'up' ? +1 : -1; cH = $('conteudo').getStyle('height').replace("px",""); tB = $('innerContent').getStyle('top').replace("px","") * y < $('innerContent').offsetHeight - cH ; //$('debug').insert( $('innerContent').getStyle('top').replace("px","") * y + ' < ' + ( $('innerContent').offsetHeight - cH ) + '|' + tB + '
' ); tC = eval($('innerContent').getStyle('top').replace("px","") + 200*y) < 200; //$('debug').insert($('innerContent').getStyle('top').replace("px","")+ ' + ' + 200*y + ' < ' + 200 + '|' + tC + '
' ); yR = tB && tC; //$('debug').insert(yR + '|' + tC + '|' + tB + '

' ); if ( yR ) { new Effect.MoveBy( $('innerContent'),y * 200, 0); } } var uploadArquivo; function init() { //$('container').setStyle({'height':document.viewport.getHeight()+"px"}); h = $('container').getHeight()-339; $('conteudo').setStyle({'height': h +"px"}); $('overlay').setStyle({'height': $('conteudo').getHeight() +"px"}); new Effect.Appear($('overlay'), { duration: 0.3, from: 0.0, to: 0.5 }); rolagem(); uploadArquivo = new SWFUpload({ // Backend Settings upload_url: "http://www.escritacontabilidade.com.br/arquivo.php", // Relative to the SWF file // File Upload Settings file_size_limit : "20MB", // 2MB file_post_name : "arquivo", flash_url : "http://www.escritacontabilidade.com.br/_shared/_swf/swfupload_f9.swf", post_params : { "chave" : "" }, file_queue_error_handler : fileQueueError, file_dialog_complete_handler : fileDialogComplete, upload_start_handler : uploadStartFunction, upload_progress_handler : uploadProgress, upload_error_handler : uploadCompleteArquivo, upload_success_handler : uploadSuccessArquivo, upload_complete_handler : uploadCompleteArquivo, debug_handler : debugFunction//, }); } window.onload = init; function debugFunction(message) { //$('debug').insert("\n\n\n" + message); } function fileQueueError(file, error_code, message) { try { if (error_code !== "") { alert("Erro: "+message); return; } } catch (ex) { this.debug(ex); } } function fileDialogComplete(num_files_queued) { try { if (num_files_queued > 0) { this.startUpload(); } } catch (ex) { this.debug(ex); } } function uploadStartFunction(file) { //arquivo = document.createElement("div"); //arquivo.id = file.id+"Div"; $('divFileProgressContainer').insert('
'); } function uploadProgress(file, bytesLoaded) { try { var percent = Math.ceil((bytesLoaded / file.size) * 100); $('div_'+file.index).update(percent+" %"); } catch (ex) { this.debug(ex); } } function uploadSuccessArquivo(file, server_data) { try { $('thumbnails').insert(server_data); } catch (ex) { this.debug(ex); } } function uploadCompleteArquivo(file) { try { $('div_'+file.index).fade(); if (this.getStats().files_queued >= 0) { this.startUpload(); } else { $('divFileProgressContainer').insert('O arquivo foi enviado corretamente'); } } catch (ex) { this.debug(ex); } } function uploadError(file, error_code, message) { var image_name = "error.gif"; var progress; try { switch (error_code) { case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: try { $(file.id).update('Cancelado'); } catch (ex1) { this.debug(ex1); } break; case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED: try { $(file.id).update('Parado'); } catch (ex2) { this.debug(ex2); } case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED: image_name = "uploadlimit.gif"; break; default: $(file.id).update(message); break; } } catch (ex3) { this.debug(ex3); } }