<script>
$(function() {
function trimChar(string, charToRemove) {
while(string.charAt(0)==charToRemove) {
string = string.substring(1);
}
while(string.charAt(string.length-1)==charToRemove) {
string = string.substring(0,string.length-1);
}
return string;
}
function updateURL() {
var addr = "/resources/profil.pdf?focus=";
var topics = ["graphics","games","marketing","multimedia","algotrading","performance","usability","network","unity"];
$.each(topics, function( index, topic ) {
if($("#"+topic+"-primary").is(":checked")) {
addr += topic+",";
}
});
$.each(topics, function( index, topic ) {
if($("#"+topic+"-yes").is(":checked")) {
addr += topic+",";
}
});
if($("#appendix-no").is(":checked")) {
addr += "noappendix,";
}
addr = trimChar(addr, ",");
var addrTxt = addr.replace(".pdf", ".txt");
$("a#link3").attr("href", addr);
$("a#link3").html("http://www.adrastea.com" + addr);
$("a#link4").attr("href", addrTxt);
$("a#link4").html("http://www.adrastea.com" + addrTxt);
}
$("input[type=radio]").click(function() {
updateURL();
});
updateURL();
});
</script>