function fakeRadio(){ $$('a[inputId="'+this.readAttribute('inputId')+'"]').each(function (e){e.removeClassName('radioFocus')}); if($(this.readAttribute('inputId')).value != this.readAttribute('value')){ this.addClassName('radioFocus'); $(this.readAttribute('inputId')).value = this.readAttribute('value'); }else{ this.removeClassName('radioFocus'); $(this.readAttribute('inputId')).value = ''; } } function imprimir( ){ window.print(); } function flashPutHref( _v ){ } function getRep(uf){ //$('mapaDir').update("Carregando..."); //new Ajax.Updater($('mapaDir'),'http://www.riomarcordas.com.br/request/?acao=representantes&uf='+uf); hs.htmlExpand($('estado_'+uf), { objectType: 'ajax', width: '500', height: '400'} ); } function getRepForm(uf){ $('representante').update("Carregando..."); new Ajax.Updater($('representante'),'http://www.riomarcordas.com.br/request/?acao=representantesFormulario&uf='+uf); } function sifrReplace(){ sIFR.replace(titulo, { selector: '.menuLi_nivel3',css: [ '.sIFR-root {kerning: true; cursor:pointer; font-size:13px; }', 'a {color: #dd0000; font-style: italic; text-align: right; text-decoration: none; }', 'a:hover {color: #35B7B7; }' ]}); sIFR.replace(titulo, { selector: '.menuLi_nivel2',css: [ '.sIFR-root {kerning: true; cursor:pointer; font-size:16px; }', 'a {color: #000000; font-style: italic; text-align: right; text-decoration: none; }', 'a:hover {color: #35B7B7; }' ]}); sIFR.replace(titulo, { selector: '.menuLi_nivel1', css: [ '.sIFR-root {kerning: true; cursor:pointer; font-size:22px; }', 'a {color: #0071BC; font-style: italic; text-align: right; text-decoration: none; }', 'a:hover {color: #35B7B7; }' ]}); sIFR.replace(titulo, { selector: '.tituloCanal',css: {'.sIFR-root': {'color': '#0071BC', 'font-size':'35px','font-style': 'italic', 'font-variant':'small-caps', 'text-align':'right' }}}); } var valid; function sendWindowForm( divForm, _form ){ divResp = 'emailResponse'+divForm; valid = new Validation( _form ,{onSubmit:false}); if(valid.validate()){ if($(divForm).previous().id != divResp) $(divForm).insert({'before' : '
'}); $('emailResponseMsg').show().update('Enviando...').addClassName('emailResponseEnviando'); new Ajax.Request('http://www.riomarcordas.com.br/request/',{ parameters: $(_form).serialize(), onComplete: function(transport) { if(transport.responseText == 'ok'){ $(divForm).update(); $('emailResponseMsg').update('A mensagem foi enviada com sucesso').removeClassName('emailResponseEnviando').removeClassName('emailResponseErro').addClassName('emailResponseEnviada'); }else{ $('emailResponseMsg').update('Não foi possível enviar a mensagem. Tente novamente, por favor.').removeClassName('emailResponseEnviando').addClassName('emailResponseErro'); } } }); } return false; } var blocoTextoImg = new Template( '' + '
' + '' + '#{legenda}' + '' + '
'); var uploadArquivo; var settingsArquivo = { upload_url : "arquivo", flash_url : "_shared/_swf/swfupload.swf", file_post_name : "arquivo", file_size_limit : "1024", // 2MB file_types : "*.jpg;*.png;*.gif", file_types_description : "Imagens JPG,GIF ou PNG", file_upload_limit : "0", post_params : { "chave" : "" }, button_image_url : "imagens/Load.png", // Relative to the SWF file button_placeholder_id : "spanButtonPlaceholderArquivo", button_width: 180, button_height: 25, button_text : 'Selecione o arquivo ', button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; }', button_text_top_padding: 0, button_text_left_padding: 18, button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT, button_cursor: SWFUpload.CURSOR.HAND, 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//, }; function initForm(){ $$('a.radio').each(function (_ele){ Event.observe(_ele, 'click', fakeRadio.bindAsEventListener(_ele)); }); $$('#spanButtonPlaceholderFotos').each(function (_ele){ uploadArquivo = new SWFUpload(settingsFotos); }); $$('.flashReplace').each(function ( _ele){ attr = _ele.readAttribute('swf') _width = _ele.getWidth(); _height = _ele.getHeight(); var fo = new Flash(attr, "swfInf", _width, _height); fo.addParameter("scale", "scale"); fo.addParameter("menu", "false"); fo.addParameter("quality", "high"); fo.addParameter("wmode", "transparent"); fo.addParameter("salign", "t"); fo.write( _ele.id); }); } function init() { initForm(); sifrReplace(); } document.observe("dom:loaded",init); hs.graphicsDir = 'http://www.riomarcordas.com.br/_shared/images/highslide/'; hs.dimmingOpacity = '0.5'; hs.transitionDuration = 20; var titulo = { src: 'http://www.riomarcordas.com.br/_imagens/sifr.swf' }; sIFR.useStyleCheck = true; sIFR.activate(titulo); 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(); } else { $('divFileProgressContainer').update(''); } } 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 { if (this.getStats().files_queued > 0) { this.startUpload(); } else { $('divFileProgressContainer').update(''); } } 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); } }