
function prepararlinkhc(codi) { //v2.0
	ent = "."; // replace this
	surt = "_"; // with this
	temp = "" + codi; // temporary holder
	while (temp.indexOf(ent)>-1) {
		pos= temp.indexOf(ent);
		temp = "" + (temp.substring(0, pos) + surt + temp.substring((pos + ent.length), temp.length));
	}
	codinou = temp;
 	ent = "*"; // replace this
 	surt = "-"; // with this
 	temp = "" + codinou; // temporary holder
 	while (temp.indexOf(ent)>-1) {
  		pos= temp.indexOf(ent);
  		temp = "" + (temp.substring(0, pos) + surt + temp.substring((pos + ent.length), temp.length));
  	}
	codinou = temp;
    codinou = "habitats_id.php?id="+codinou;
    location.href=codinou;
}

function prepararlinkhic(codi) { //v2.0
	codinou = codi;
    codinou = "habitats_idhic.php?id="+codinou;
    location.href=codinou;
}

function prepararlink(codi) { //v2.0
	codinou = codi;
    codinou = "habitats_idhic.php?id="+codinou;
    location.href=codinou;
}

function prepararlinkhcpdf(codi) { //v2.0
	ent = "+"; // replace this
	surt = " = "; // with this
	temp = "" + codi; // temporary holder
	while (temp.indexOf(ent)>-1) {
		pos= temp.indexOf(ent);
		temp = "" + (temp.substring(0, pos) + surt + temp.substring((pos + ent.length), temp.length));
	}
	codinou = temp;
	ent = " "; // replace this
	surt = ""; // with this
	temp = "" + codi; // temporary holder
	while (temp.indexOf(ent)>-1) {
		pos= temp.indexOf(ent);
		temp = "" + (temp.substring(0, pos) + surt + temp.substring((pos + ent.length), temp.length));
	}
	codinou = temp;
	location.href="http://mediambient.gencat.net/cat/el_medi/habitats/fitxespdf/"+codinou+".pdf";
}
function prepararlinkhchtm(codi) { //v2.0
	ent = "+"; // replace this
	surt = " = "; // with this
	temp = "" + codi; // temporary holder
	while (temp.indexOf(ent)>-1) {
		pos= temp.indexOf(ent);
		temp = "" + (temp.substring(0, pos) + surt + temp.substring((pos + ent.length), temp.length));
	}
	codinou = temp;
	ent = " "; // replace this
	surt = ""; // with this
	temp = "" + codi; // temporary holder
	while (temp.indexOf(ent)>-1) {
		pos= temp.indexOf(ent);
		temp = "" + (temp.substring(0, pos) + surt + temp.substring((pos + ent.length), temp.length));
	}
	codinou = temp;
    location.href="http://mediambient.gencat.net/cat/el_medi/habitats/fitxeshtm/"+codinou+".htm";
}

function prepararlinklleg(codi) { //v2.0
    location.href="habitats_idu.php?id="+codi;
}


