
/*
SimpleStats 6.10 functions.
*/

function sst610(sitio,tipo,titulo,path,id) {
  path      = path.toLowerCase();
  path      = cleanstring(path);
  titulo    = cleanstring(titulo);
  tipo      = cleanstring(tipo);
  path      = path.replace(/;;/g, ';');
  path      = path.replace(/[^0-9a-zA-Z;\/\_\-]/g, '');
  path      = path.replace(/;/g, '/');
  sitio     = sitio.replace(/[^0-9a-zA-Z\_\-]/g, '');
  id        = id.replace(/[^0-9\-]/g, '');
  var url       = document.location+'';
  url       = url.replace(/[\<\>\%]/g, '');
  url       = url.replace(/\s/g, '');

  var sst6_url_source="http://www.aduana.cl/sst6_10.sst?site="+sitio+"&id="+id+"&tipo="+tipo+"&tit="+titulo+"&path="+path+"&url="+url;
  document.writeln("<img height=\"1\" width=\"1\" src=\"" + sst6_url_source + "\">");

};

function cleanstring(texto){
  texto = texto.replace(/á/g, 'a');
  texto = texto.replace(/é/g, 'e');
  texto = texto.replace(/í/g, 'i');
  texto = texto.replace(/ó/g, 'o');
  texto = texto.replace(/ú/g, 'u');
  texto = texto.replace(/ñ/g, 'n');
  texto = texto.replace(/ü/g, 'u');
  texto = texto.replace(/Á/g, 'A');
  texto = texto.replace(/É/g, 'E');
  texto = texto.replace(/Í/g, 'I');
  texto = texto.replace(/Ó/g, 'O');
  texto = texto.replace(/Ú/g, 'U');
  texto = texto.replace(/Ñ/g, 'N');
  texto = texto.replace(/Ü/g, 'U');
  return texto;
};


