['Non-free Crown copyright', 'UK Crown Copyright'],
['Non-free New Zealand Crown Copyright', 'NZ Crown Copyright'],
['Non-free Canadian Crown Copyright', 'Canadian Crown Copyright'],
['Non-free AUSPIC', 'AUSPIC (Australian Parliament image database'],
['Non-free Philippines government', 'Philippines government'],
['Non-free Finnish Defence Forces', 'Finnish Defence Forces'],
[],
['Other individual sources'],
['Non-free Denver Public Library', 'Denver Public Library'],
['Non-free ESA media', 'ESA (European Space Agency)'],
[],
['Possibly public domain in other countries'],
['Non-free Old-50', 'Author died more than 50 years ago.'],
['Non-free Old-70', 'Author died more than 70 years ago.'],
[],
['Some permissions granted, but not completely free'],
['Non-free promotional', 'From promotional press kit'],
['Non-free with NC', 'Permission granted, but only for educational and/or non-commercial purposes'],
['Non-free with ND', 'Permission granted, but no derivative works allowed'],
['Non-free with permission', 'Permission granted, but only for Wikipedia'],
[]
]
};
for (var group in licenseLists) {
fuwMakeSelection(group, licenseLists[group]);
}  
this.knownCommonsLicenses = {
'self|GFDL|cc-by-sa-all|migration=redundant' : 1,
'self|Cc-zero' : 1,
'PD-self' : 1,
'self|GFDL|cc-by-sa-3.0|migration=redundant' : 1,
'self|GFDL|cc-by-3.0|migration=redundant' : 1,
'self|cc-by-sa-3.0' : 1,
'cc-by-sa-3.0' : 1,
'cc-by-sa-2.5' : 1,
'cc-by-3.0' : 1,
'cc-by-2.5' : 1,
'FAL' : 1,
'PD-old-100' : 1,
'PD-old' : 1,
'PD-Art' : 1,
'PD-US' : 1,
'PD-USGov' : 1,
'PD-USGov-NASA' : 1,
'PD-USGov-Military-Navy' : 1,
'PD-ineligible' : 1,
'Attribution' : 1,
'Copyrighted free use' : 1
};  
// textfields that don't react directly
// to user input and are used only for assembling stuff:
if (fuwTesting) {
fuwMakeTextfield('SandboxSummary', function{void(0);});
fuwMakeTextarea('SandboxText', function{void(0);});
fuwGet('SandboxSummary').disabled="disabled";
fuwGet('SandboxText').disabled="disabled";
fuwGet('SandboxText').rows = 12;
}  
// set links to "_blank" target, so we don't accidentally leave the page,
// because on some browsers that would destroy all the input the user has already entered
$('.fuwOutLink a').each(function {
this.target = '_blank';
});  
// make main area visible
fuwSetVisible('UploadScriptArea', true);  
}
// ======================================
// end of fuwGlobal constructor function
// ======================================  
function fuwRadioClick(e) {
var ev = e || event;
var src = ev.target || ev.srcElement;
//alert('onclick event from ' + src + ' (' + src.value + ')');
fuwUpdateOptions;
return true;
}  
/*
- =============================================================
- function fuwUpdateOptions
- =============================================================
- This is the onchange event handler for most of the input
- elements in the main form. It changes visibility and disabled
- status for the various sections of the input form in response
- to which options are chosen.
- /
function fuwUpdateOptions {  
var fuw = window.fuw;
var warn = fuw.warn;
var opts = fuw.opts = { };
opts.InputFilename = $('#TargetForm input#file').val;  
var widgets = fuw.ScriptForm.elements;
for (i = 0; i < widgets.length; i++) {
var w = widgets[i];
if (w.type == "radio") {
var nm = w.name;
var id = w.id;
var vl = w.checked && !w.disabled && fuwIsVisible(w);
opts[id] = vl;
if (vl) opts[nm] = id;
}
else {
var id = w.id;
var active = !w.disabled && fuwIsVisible(w);
if (active) {
var value = ((type == 'checkbox') ? w.checked : w.value);
opts[id] = value;
}
}
};
opts.MainOption = opts.FreeOptions || opts.NonFreeOptions;  
// some parts of the input form are re-used across sections
// and must be moved into the currently active input section:  
// minimality section is shared between all NF sections
fuwMove('NFMinimalitySection', 'detailsNFSubject', (opts.OptionNFSubject)) ||
fuwMove('NFMinimalitySection', 'detailsNF3D', (opts.OptionNF3D)) ||
fuwMove('NFMinimalitySection', 'detailsNFExcerpt', (opts.OptionNFExcerpt)) ||
fuwMove('NFMinimalitySection', 'detailsNFCover', (opts.OptionNFCover)) ||
fuwMove('NFMinimalitySection', 'detailsNFLogo', (opts.OptionNFLogo)) ||
fuwMove('NFMinimalitySection', 'detailsNFPortrait', (opts.OptionNFPortrait)) ||
fuwMove('NFMinimalitySection', 'detailsNFMisc', true);  
// AnyOtherInfo section is shared between all
fuwMove('AnyOtherInfo', 'detailsOwnWork', opts.OptionOwnWork) ||
fuwMove('AnyOtherInfo', 'detailsThirdParty', opts.OptionThirdParty) ||
fuwMove('AnyOtherInfo', 'detailsFreeWebsite', opts.OptionFreeWebsite) ||
fuwMove('AnyOtherInfo', 'detailsPDOld', opts.OptionPDOld) ||
fuwMove('AnyOtherInfo', 'detailsPDOther', opts.OptionPDOther) ||
fuwMove('AnyOtherInfo', 'detailsNFSubject', opts.OptionNFSubject) ||
fuwMove('AnyOtherInfo', 'detailsNF3D', opts.OptionNF3D) ||
fuwMove('AnyOtherInfo', 'detailsNFExcerpt', opts.OptionNFExcerpt) ||
fuwMove('AnyOtherInfo', 'detailsNFCover', opts.OptionNFCover) ||
fuwMove('AnyOtherInfo', 'detailsNFLogo', opts.OptionNFLogo) ||
fuwMove('AnyOtherInfo', 'detailsNFPortrait', opts.OptionNFPortrait) ||
fuwMove('AnyOtherInfo', 'detailsNFMisc', opts.OptionNFMisc);  
// author input field is shared between all sections except "Own Work".
// (will serve for the immediate/photographic author, in those cases where there
// are two author fields)
fuwMove('Author', 'placeholderFreeWebsiteAuthor', (opts.OptionFreeWebsite)) ||
fuwMove('Author', 'placeholderPDOldAuthor', (opts.OptionPDOld)) ||
fuwMove('Author', 'placeholderPDOtherAuthor', (opts.OptionPDOther)) ||
fuwMove('Author', 'placeholderNFSubjectAuthor', (opts.OptionNFSubject)) ||
fuwMove('Author', 'placeholderNF3DAuthor', (opts.OptionNF3D)) ||
fuwMove('Author', 'placeholderNFExcerptAuthor', (opts.OptionNFExcerpt)) ||
fuwMove('Author', 'placeholderNFCoverAuthor', (opts.OptionNFCover)) ||
fuwMove('Author', 'placeholderNFPortraitAuthor', (opts.OptionNFPortrait)) ||
fuwMove('Author', 'placeholderNFMiscAuthor', (opts.OptionNFMisc)) ||
fuwMove('Author', 'placeholderAuthor', true);  
// source input field is shared between all sections except "Own Work".
// (will serve for immediate/web source, in those cases where there are two
// source fields involved)
fuwMove('Source', 'placeholderFreeWebsiteSource', (opts.OptionFreeWebsite)) ||
fuwMove('Source', 'placeholderPDOldSource', (opts.OptionPDOld)) ||
fuwMove('Source', 'placeholderPDOtherSource', (opts.OptionPDOther)) ||
fuwMove('Source', 'placeholderNFSubjectSource', (opts.OptionNFSubject)) ||
fuwMove('Source', 'placeholderNF3DSource', (opts.OptionNF3D)) ||
fuwMove('Source', 'placeholderNFExcerptSource', (opts.OptionNFExcerpt)) ||
fuwMove('Source', 'placeholderNFCoverSource', (opts.OptionNFCover)) ||
fuwMove('Source', 'placeholderNFLogoSource', (opts.OptionNFLogo)) ||
fuwMove('Source', 'placeholderNFPortraitSource', (opts.OptionNFPortrait)) ||
fuwMove('Source', 'placeholderNFMiscSource', (opts.OptionNFMisc)) ||
fuwMove('Source', 'placeholderSource', true);  
// date input field is shared between all sections except "Logo", which doesn't need it.
// will serve for derived/photographic date in the case of 3D items
fuwMove('Date', 'placeholderFreeWebsiteDate', (opts.OptionFreeWebsite)) ||
fuwMove('Date', 'placeholderThirdPartyDate', (opts.OptionThirdParty)) ||
fuwMove('Date', 'placeholderPDOldDate', (opts.OptionPDOld)) ||
fuwMove('Date', 'placeholderPDOtherDate', (opts.OptionPDOther)) ||
fuwMove('Date', 'placeholderNFSubjectDate', (opts.OptionNFSubject)) ||
fuwMove('Date', 'placeholderNF3DDate', (opts.OptionNF3D)) ||
fuwMove('Date', 'placeholderNFExcerptDate', (opts.OptionNFExcerpt)) ||
fuwMove('Date', 'placeholderNFCoverDate', (opts.OptionNFCover)) ||
fuwMove('Date', 'placeholderNFPortraitDate', (opts.OptionNFPortrait)) ||
fuwMove('Date', 'placeholderNFMiscDate', (opts.OptionNFMisc)) ||
fuwMove('Date', 'placeholderDate', true);  
// permission field is shared between ThirdParty and FreeWebsite sections