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 cadastraNewsletter(){ var email = $('newsletterEmail').value; $('newsletter').update("Carregando..."); new Ajax.Updater($('newsletter'),'http://www.torneadosgaspar.com.br/_ajax.php?acao=cadastraNewsletter&email='+email); } function rolar( dir , div){ x = dir == 'left' ? +1 : -1; listaProdutosWidth = $('listaProdutos_'+div).getStyle('width').replace("px",""); listaLeft = $('lista_'+div).getStyle('left').replace("px","").replace("pt",""); listaWidth = $('lista_'+div).getStyle('width').replace("px","").replace("pt",""); tB = listaLeft * x < listaWidth - listaProdutosWidth ; tC = eval(listaLeft + x * listaProdutosWidth ) < 0; if ( tB && tC ) { new Effect.MoveBy( $('lista_'+div), 0 ,x * listaProdutosWidth); } } function displayMsgOk(_msg,_bg){ $('emailResponse').update(_msg).setStyle({ background: _bg }); new Effect.Fade($('emailResponse')); } function displayMsgErro(_msg,_bg){ $('emailResponse').update(_msg).setStyle({ background: _bg }); } var imgC = 0; function sendWindowForm( divForm, _form ){ $$(".inputField").each(function(_ele){ if(_ele.value == _ele.readAttribute('myvalue')) _ele.value = ''; }); divResp = 'emailResponse'+divForm; var valid; valid = new Validation( _form.id ,{onSubmit:false}); if(valid.validate()){ if($(divForm).firstDescendant().id != divResp) $(divForm).insert({'top' : '
'}); new Effect.Appear($(divResp),{duration: 1}); $(divResp).update('Enviando...').setStyle({ background: '#FFFF99' }); new Ajax.Request('http://www.torneadosgaspar.com.br/_ajax.php',{ parameters:_form.serialize(), onComplete: function(transport) { if(transport.responseText == 'ok'){ $(divResp).update('A mensagem foi enviado com sucesso').setStyle({ background: '#dfd' }); }else{ $(divResp).update('Não foi possível enviar a mensagem neste momento. Tente novamente, por favor.').setStyle({ background: '#fdd' }); } } }); } $$(".inputField").each(function(_ele){ if(_ele.value == '') _ele.value = _ele.readAttribute('myvalue'); }); $('aviso').toggle(); return false; } function menu(_div){ x = parseInt(-$('conteudo').offsetLeft) - parseInt($('div'+_div).offsetLeft); new Effect.MoveBy( $('conteudo'),0,x); hs.close() pageTracker._trackPageview(_div); } function blog_focus(){ this.addClassName('inputFocus'); if(this.value == this.readAttribute('myvalue')){ this.value = ''; } this.previous('label').addClassName('labelFocus'); } function blog_blur(){ if(this.value == ''){ this.removeClassName('inputFocus'); this.value = this.readAttribute('myvalue'); this.previous('label').removeClassName('labelFocus'); } } function init() { $$(".inputField").each(function(_ele){ _ele.value = _ele.readAttribute('myvalue'); Event.observe(_ele, 'focus', blog_focus.bindAsEventListener(_ele)); Event.observe(_ele, 'blur', blog_blur.bindAsEventListener(_ele)); }); $$('a.radio').each(function (_ele){ Event.observe(_ele, 'click', fakeRadio.bindAsEventListener(_ele)); }); } Event.observe(window, 'load',init); hs.align = 'center'; //hs.allowMultipleInstances = false; hs.cacheAjax = false; hs.graphicsDir = 'http://www.torneadosgaspar.com.br/_shared/images/highslide/'; hs.showCredits = false; hs.closeText = 'Fechar'; hs.loadingText = 'Carregando...';