function ChangeCategory(catid) { if(catid == 1) { $('#split_releasetype').show(); $('#split_artist').show(); $('#split_year').show(); } else if(catid == 4 || catid == 6) { $('#split_releasetype').hide(); $('#split_year').show(); $('#split_artist').hide(); } else { $('#split_releasetype').hide(); $('#split_artist').hide(); $('#split_year').hide(); } } function ArtistManager() { var GroupID = window.location.search.match(/[?&]id=(\d+)/); if(typeof GroupID == 'undefined') { return; } else { GroupID = GroupID[1]; } var ArtistList; if(!(ArtistList = $('#artist_list').raw())) { return false; } else if($('#artistmanager').raw()) { $('#artistmanager').toggle(); $('#artist_list').toggle(); } else { MainArtistCount = 0; var elArtistManager = document.createElement('div'); elArtistManager.id = 'artistmanager'; var elArtistList = ArtistList.cloneNode(true); elArtistList.id = 'artistmanager_list'; for(var i=0, importance = 1; i StartBox ? 1 : -1); var checked = obj.checked; for(var i = StartBox; i != EndBox; i += Dir) { var key, importance = obj.value.substr(0,1), id = obj.value.substr(2); $('#artistmanager_box'+i).raw().checked = checked; } StartBox = Number(obj.id.substr(17)); } function ArtistManagerSubmit() { var Selection = new Array(); var MainSelectionCount = 0; for(var i = 0, boxes = $('[name="artistmanager_box"]'); boxes.raw(i); i++) { if(boxes.raw(i).checked) { Selection.push(boxes.raw(i).value.substr(2)); if(boxes.raw(i).value.substr(0,1) == '1') { MainSelectionCount++; } } } if(Selection.length == 0 || ($('#manager_action').raw().value == 'delete' && !confirm('Are you sure you want to delete '+Selection.length+' artists from this group?'))) { return; } $('#artists_selection').raw().value = Selection.join(','); if(($('#artists_importance').raw().value != 1 || $('#manager_action').raw().value == 'delete') && MainSelectionCount == MainArtistCount) { if(!$('.error_message').raw()) { error_message('All groups need to have at least one main artist.'); } $('.error_message').raw().scrollIntoView(); return; } $('#artistmanager_form').raw().submit(); } function ArtistManagerDelete() { $('#manager_action').raw().value = 'delete'; ArtistManagerSubmit(); $('#manager_action').raw().value = 'manage'; }