////
// Author: Sean Colombo
// Date: 20061226
//
// Javascript for the entire Album Maker (all steps).
////
var NEXT_UPLOAD_ID = 7;
// Returns the id of the album currently selected in the drop-down.
function getAlbumId(){
var sel = el('whichAlbum');
return sel.options[sel.selectedIndex].value;
} // end getAlbumId()
// Makes another upload field.
function addUploader(){
var upCode = "";
var albumId = getAlbumId();
var failureCode = "IFRAME support required. Please use a modern browser, or complain to the management.";
// Since this code is built to work even if it's not running in the root directory of a server, we have to look up the pgae url here.
var frameUrl = $('iframe.uploadFrame').get(0).src;
frameUrl = frameUrl.replace(/^(.*?)\?.*$/, "$1"); // chop off the query-string
upCode += "";
$("#addAnotherUploader").before(upCode);
NEXT_UPLOAD_ID++;
} // end addUploader()
////
// Changes the albumId setting on all of the upload forms.
////
function updateAlbumIds(){
var albumId = getAlbumId();
$('iframe.uploadFrame').each(function(i){
var iframeId = $(this).attr('id');
var field = self.frames[iframeId].document.getElementById('albumIdField');
if(field){
field.value = albumId;
}
});
} // end updateAlbumIds()
$(document).ready(function(){
//$('#whichAlbum').change(updateAlbumIds()); // This fired the event instead of binding it... inlined it for now.
// Wait until the iframes can be revealed before showing this area (still doesn't work in Fox).
$('#dropBox_agree_loading').hide();
$('#dropBox_agree_label').show();
// Make agreement toggle the visibility of the forms.
$('#dropBox_agree').click(function(){
$('#dropBox_agree_label').toggle();
$('#allForms').slideDown('slow', function(){
el('allForms').style.display = 'table'; // without this "Add another" will make new fields not take up space
});
});
});