var config = {"urls":{"site":"http:\/\/www.ruadireita.com\/","imgs":"http:\/\/www.ruadireita.com\/images\/"}}; var mouse_is_inside = false; $('#dropdown').click( function(e) { e.preventDefault(); $('#realdropdown').toggle(); } ); $('.dropli').hover( function() { $(this).children('.dropdown-subcontent').show(); }, function(){ $(this).children('.dropdown-subcontent').hide(); } ); $('#realdropdown,.button-dropdown-categories').hover( function(){ mouse_is_inside=true; }, function(){ mouse_is_inside=false; } ); $('.dropdown-subcontent li').click( function(){ window.location.href = $('a',this).attr('href'); } ); $(document).click( function() { if(! mouse_is_inside) { $('#realdropdown').hide(); } } ).ready( function() { $(".btndisabled").attr('disabled', false); } ); function testMinChars(fieldId, minLimit){ var cleanStr = $("#" + fieldId).val().replace(/(\s|\r|\n)/ig,""); if( minLimit - cleanStr.length > 0 ){ $("#" + fieldId + '_min').html('Faltam ' + (minLimit - cleanStr.length) + ' caracteres'); return false; }else{ $("#" + fieldId + '_min').html(''); return true; } } function test_price_press(e,preco){ var key = e.which; if(preco.val().match(/\./) && (key==44 || key==46)){ return false; } if(key==44){ preco.val(preco.val()+'.'); return false; } if(key != 46 && key > 31 && (key < 48 || key > 57)) { return false; } return true; } function test_price_up(preco){ var oval=preco.val(); if(oval.indexOf(".") > -1){ var odec=oval.split('.'); if(odec[1].length>2){ preco.val(odec[0]+'.'+odec[1].substring(0,2)); } } } function isEmpty(formElement, message) { _isEmpty = false; if (formElement.val() == '') { _isEmpty = true; alert(message); formElement.focus(); } return _isEmpty; } function isEmail(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ alert("E-mail invalido") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ alert("E-mail invalido") return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ alert("E-mail invalido") return false } if (str.indexOf(at,(lat+1))!=-1){ alert("E-mail invalido") return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ alert("E-mail invalido") return false } if (str.indexOf(dot,(lat+2))==-1){ alert("E-mail invalido") return false } if (str.indexOf(" ")!=-1){ alert("E-mail invalido") return false } return true } $("#pesquisa,#centered_search").submit(function(){ if($("#q").val().length<3){ alert('Não pode pesquisar palavras com menos de 3 caracteres!'); $("#q").focus(); return false; } return true; }); $('.clickme').click(function() { window.location.href = $('a',this).attr('href'); });