﻿//This script acts as a workaround for what would have been a nested form due to the HTMl layout of the page
$(document).ready(function() {
    initEditionChooserBox();
});

function initEditionChooserBox() {
    //Add a change event to the sort dropdown
    $("#editionChooserSort").change(function() { reSortEditionList(this.value); });
}

function reSortEditionList(what) {
    var currentUrl = document.location + "";
    if (currentUrl.indexOf("?sort=") >= 0) {
        currentUrl = currentUrl.split("?sort=")[0];
    }
    document.location = currentUrl + "?sort=" + what + "#editionChooserA";
}