/* SearchField written by Alen Grakalic, provided by Css Globe (cssglobe.com) please visit http://cssglobe.com/post/1202/style-your-websites-search-field-with-jscss/ for more info */ this.search = function(){ // CONFIG // this is id of the search field you want to add this script to. // You can use your own id just make sure that it matches the search field in your html file. var id = "searchPost"; // Text you want to set as a default value of your search field. var defaultText = "insira termo.."; // set to either true or false // when set to true it will generate search suggestions list for search field based on content of variable below var suggestion = true; // static list of suggestion options, separated by comma // replace with your own //var suggestionText = "surf, sexo"; var suggestionText = ", Programa, Avançado, Fiscalidade, HACCP, Segurança, Alimentar, Técnico, Higiene, Trabalho, Nível, III, Superior, SHT, Normas, Internacionais, Contabilidade, (IFRS), (42, Créditos), Higiene, Sector, das, Carnes, (Talhos), Formação, Pedagógica, Inicial, Formadores, Técnicas, Eficazes, Cobranças, Segurança, Saúde, Construção, Civil, Como, Fazer, Plano, Comunicação, Interna, Auditorias, Sistemas, HACCP, Implementação, Sistema, Gestão, Ambiental, (ISO, 14001), Imagem, Protocolo, Organização, Eventos, Novo, Modelo, Contabilístico, 2010, SNC, Finanças, Auditoria, (31, Workshop, Compostagem, Agricultura, Biológica, Gestão, Tempo, Media, Trainning, Projectos, Fiscalização, Obra, Marketing, Online, Exploração, Recursos, Didáticos, Audiovisual, Multimédia, Tesouraria, para, Manipuladores, WebMarketing, Prático, Ferramentas, CRM, Qualidade, Utilização, Meios, Primeira, Intervenção, Combate, Incêndios, (UMPICI), Contínua, Curso, Negociação, Internacional, Protocolo, Aplicado, Secretariado, Administração, Elaboração, Análise, Investimento, Empresarial, Multicultural, Auditoria, Financeira, Balanços, Desempenho, Funções, por, Trabalhadores, Designados, Caixa, Estratégia, Planeamento, Riscos, Profissionais, Medidas, Prevenção, INCOTERMS, Procedimentos, Transporte, Gerir, Dinâmicos:, Técnicas, Reais, Resíduos, Redução, Custos, Master, Fiscal, Avançada, Primeiros, Socorros, Suporte, Básico, Vida, (SBV), ISO, 22000, Integrado, (Qualidade, Ambiente, Segurança), Sistemas, 9001:2008, Empreendedor, Profissão, Marketing, Digital:, Conquistar, Reter, Gerar, Clientes, usando, Canais, Digitais, Competências, Coaching, Mentoring, Gestores, Aprender, reutilizar, Atelier, prático, Desempenho, Motivação, Liderança, Projectos:, que, Funcionam, através, Pessoas, Manuseamento, Manual, Cargas, Utilizar, Conceito, VALOR, Conceber, uma, Eficaz, Factores, Risco, Posto, Informatizado, (GFRPTI), Excelência, Serviço, Cliente, Pensamento, Criativo, Igualdade, entre, Homens, Mulheres, Prevenção, Protecção, SHST, Stress, Programação, Neurolinguística, Chaves, Sucesso, Benchmarking, Ambientais, com, Competências, Ganhe, dinheiro, poupando, ambiente, ferramenta, Educar, Sensibilizar, Mudança:, Rapidez, Inovação, Fazer, Prospecção, Estratégica, Marcar, Reuniões, Construir, Dinamizar, Avaliação, Profissional, Conseguir, nos, Mercados, e-Business, Negócios, Gestor, Líder, Pilares, Afirmação, Pessoal, Empreendedorismo, Corporativo, Toxicodependência, Desenvolvimento, Executivos, Liderança, Direcção, Comércio, ISO/TS, 16949:2002, Automóvel, Posturas, Trabalham, Excel, Negócio, Conceber, Seu, Uma, Perspectiva, Prática, Negociação, Vendas, Como, Proveitosas, Vibrações, Radiações, Venda, Serviços, Telefone, Plataformas, e-Commerce, Carreiras, Mobilidade, Responsabilidade, Social, Norma, 8000, Secretariado, Activo, Desenvolver, Desenvolver, Exportações, Estratégia, Marca, Branding, Strategy, Ergonomia, Condução, Identificar, Seleccionar, Oportunidades, Orientada, Empreendedor?, Negociar, Operações, Cenário, Global, Contas, Project, Contabilidade, Grupos, Económicos, Pesquisa, Crescer, Novos/Futuros, Soluções, Inteligentes:, Vender, Proposta, Valor, Elaborar, Inteligência, Competitiva, Introdução, Novos, Produtos, Estratégias, Rápidas, Implementação, ser, Inspirador, Influente, Distribuição, Grandes, (Mobile, Marketing), Comunicar, Causar, Impacto, Gestor, Informáticos, WIN-WIN, Apresentações, Campanhas, Obter, Permissão, Liderar, Equipa, Excelente, Consciência, Comercial, Elementos, Administrativos, Quanto, Vale, seu, Produto/Serviço, Cliente?, Imagem, Liderar, Forma, Remota, Controlo, exposição, Agentes, Químicos, Melhoria, Processos, Melhoria, Conseguir, Resultados, sem, Autoritarismo, Ciclo, Língua, Árabe, Básico*, NOVO, Avançado*NOVO, Intermédio*NOVO, Espanhol, nivel"; //PBS - PHP dentro de JAVASCRIPT ! ou vice-versa.. ATENÇÃO Q NO SERVIDOR DA 000WEBHOST N FUNCIONA.. // END CONFIG (do not edit below this line, well unless you really, really want to change something :) ) // Peace, // Alen var field = document.getElementById(id); var classInactive = "sf_inactive"; var classActive = "sf_active"; var classText = "sf_text"; var classSuggestion = "sf_suggestion"; this.safari = ((parseInt(navigator.productSub)>=20020000)&&(navigator.vendor.indexOf("Apple Computer")!=-1)); if(field && !safari){ field.value = defaultText; field.c = field.className; field.className = field.c + " " + classInactive; field.onfocus = function(){ this.className = this.c + " " + classActive; this.value = (this.value == "" || this.value == defaultText) ? "" : this.value; }; field.onblur = function(){ this.className = (this.value != "" && this.value != defaultText) ? this.c + " " + classText : this.c + " " + classInactive; this.value = (this.value != "" && this.value != defaultText) ? this.value : defaultText; clearList(); }; if (suggestion){ var selectedIndex = 0; field.setAttribute("autocomplete", "off"); var div = document.createElement("div"); var list = document.createElement("ul"); list.style.display = "none"; div.className = classSuggestion; list.style.width = field.offsetWidth + "px"; div.appendChild(list); field.parentNode.appendChild(div); field.onkeypress = function(e){ var key = getKeyCode(e); if(key == 13){ // enter selectList(); selectedIndex = 0; return false; }; }; field.onkeyup = function(e){ var key = getKeyCode(e); switch(key){ case 13: return false; break; case 27: // esc field.value = ""; selectedIndex = 0; clearList(); break; case 38: // up navList("up"); break; case 40: // down navList("down"); break; default: startList(); break; }; }; this.startList = function(){ var arr = getListItems(field.value); if(field.value.length > 0){ createList(arr); } else { clearList(); }; }; this.getListItems = function(value){ var arr = new Array(); var src = suggestionText; var src = src.replace(/, /g, ","); var arrSrc = src.split(","); for(i=0;i 0) { for(i=0;i li.length) selectedIndex = 1; navListItem(selectedIndex); }; this.navListItem = function(index){ selectedIndex = index; li = list.getElementsByTagName("li"); for(var i=0;i