// SNARK codi del script Copyright(C) 1996, Justin Boyan, jab+j@cs.cmu.edu
//filtres de recerca en catala (c)2001, Ferran Jorda, ferran@nitium.com
var MAX_ENGINES = 30;var SNARK_STRING = "hunting+the+snark";function MakeArray(n) {for (var i = 1; i <= n; i++) {this[i] = 0;}this.maxlen = n;this.len = 0;return this;}var engs = new MakeArray(MAX_ENGINES);function find_substring(needle, haystack) {var i, needlen = needle.length, haylen = haystack.length;for (i=0; i<=haylen-needlen; i++) {if (needle == haystack.substring(i,i+needlen))return i;}return false;}function Engine(name, opts, home, search) {var snark = find_substring(SNARK_STRING, search);this.name = name;this.opts = opts;this.home = home;this.pre_snark = search.substring(0,snark);this.post_snark= search.substring(snark+SNARK_STRING.length, search.length);}function Add(name, opts, home, search) {engs.len++;if (engs.len <= engs.maxlen) {engs[engs.len] = new Engine(name, opts, home, search)}else {alert("Better increase MAX_ENGINES: " + engs.len + ">" + engs.maxlen)}}Add("Google","","http://www.google.com/advanced_search?hl=ca&lr=&safe=off", "http://www.google.com/search?q=hunting+the+snark&safe=off&hl=ca&btnG=porta" );Add("FAST - Alltheweb", "","http://www.alltheweb.com/","http://www.alltheweb.com/search?cat=web&lang=any&query=hunting+the+snark" );Add("Google, catal&agrave;","","http://directory.google.com/Top/World/Catal&agrave;/","http://www.google.com/search?hl=ca&q=hunting+the+snark&lr=lang_ca" );Add("Google, cat. i esp.","","http://directory.google.com/Top/World/Catal&agrave;/","http://www.google.com/search?hl=ca&q=hunting+the+snark&lr=lang_ca|lang_es" );Add(" Vivisimo, metacerca","","http://vivisimo.com/form?form=Advanced","http://vivisimo.com/search?query=hunting+the+snark&se=Yahoo%2CMSN%2CFast%2CNetscape%2COD%2CLooksmart%2CAskJeeves&enablejs=1" );Add("Open Directory","","http://search.dmoz.org/","http://search.dmoz.org/cgi-bin/search?search=hunting+the+snark" );Add("ez2Find, metacerca","","http://ez2find.com/","http://ez2find.com/meta/web/search.mpl?theme=default&qry_str=hunting+the+snark&category=Web&mode=all&per_page=100&timeout=2&depth=1&modules=aa_opendirectory.pm&modules=ab_google.pm&modules=ac_alltheweb.pm&modules=ad_altavista.pm&modules=ae_msn.pm&modules=af_yahoo.pm&modules=ag_wisenut.pm&modules=ah_teoma.pm");Add("Yahoo","","http://www.yahoo.com/","http://search.yahoo.com/bin/search?p=hunting+the+snark");Add("Yahoo, catal&agrave;","","http://ct.yahoo.com/","http://ct.search.yahoo.com/search/ct?p=hunting+the+snark");Add("Kartoo, en flash","","http://www.kartoo.com","http://www.kartoo.com/flash.php3?q=hunting+the+snark");function HandleForm(form) {form.submit(); var i, oldq=form.query.value, newq="";for (i=0; i<oldq.length; i++) {  var thischar = oldq.charAt(i);if (thischar != ' ')newq += thischar;else if (lastchar != ' ')newq += '+';lastchar = thischar;}var eng = engs[1+form.service.selectedIndex];location.href = newq ? eng.pre_snark + newq + eng.post_snark : eng.home;}function DisplayForm() {document.writeln('<FORM OnSubmit="HandleForm(this); return false">');document.writeln('<font color="Maroon" size="-1"><b>Recerca amb</b>:</font> <select name="service"  class="caixa2">');for (i=1; i <= engs.len; i++) {document.writeln("<OPTION " + engs[i].opts + "> " + engs[i].name);}document.writeln('</SELECT><INPUT size="20" class="caixa2" name="query"><input type="submit" value="Troba!" class="caixa1" >&nbsp;&nbsp;&nbsp;&nbsp;</FORM>');}DisplayForm();  
//eurocalc
function formatnumber(number){ var i = 0; var result = ""; var limit = 0; num = (Math.round(number*100))/100;	 num = num + ""; var len = num.length; var posit = num.indexOf("."); if (num == "NaN") result = "error!"; else{ if (posit == "-1")  result = num + ".00";  else{if (posit == "0")  result = "0";  limit = posit;         if ((len-posit) >= 3)  result = result + num; else{ for (i=0; i<limit; i++)  result = result + num.charAt(i); result = result + "."; if ((len-posit) == 2) result = result + num.charAt(limit+1) + "0"; else if ((len-posit) == 1) result = result + "00";}}} return(result);} function convert(country, currency){ var euros; if (country != "EUR"){ eval("euros = document.cal." + country + ".value/" + currency + ";"); eval("document.cal.EUR.value = formatnumber(euros);");}else{  euros = document.cal.EUR.value;}  if (country != "ESP")  document.cal.ESP.value =formatnumber(euros*166.386);};