
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2008 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
*
* $DateTime: 2008/04/10 13:35:00 $
*
* Adobe Output Module 2.0
*
* MediaGallery Originally Written by Quality Process Incorporated, Enhanced by
* Adobe System China. Contact Sheet written by Adobe System China.
* 
*
**************************************************************************/

AOM.AmgGalleryMaker = function() {};
AOM.AmgGalleryMaker.models = {};
AOM.AmgGalleryMaker.uninitialized = true;
AOM.AmgGalleryMaker.validationRules = {};
AOM.AmgGalleryMaker.initialize = function ()
{
	if (AOM.AmgGalleryMaker.uninitialized)
	{
		AOM.AmgGalleryMaker.processTemplatesAndStyles();
		AOM.AmgGalleryMaker.uninitialized = false;
	}
}
AOM.AmgGalleryMaker.templatePath = function (template, doc)
{
	if (template == undefined)
		template = AOM.AmgTemplateSection.currentTemplate(doc);
	return AOM.AMG.Paths.templates + template;
}
AOM.AmgGalleryMaker.stylePath = function (template, style, doc)
{
	if (template == undefined)
		template = AOM.AmgTemplateSection.currentTemplate(doc);
	if (style == undefined)
		style = AOM.AMG.userInput(doc).currentUserInput.get("si_style");
	return AOM.AMG.Paths.templates + template + "/styles/" + style;
}
/* Seems no reference to these functions. Comment them out to see if they
 * have any use. In the "Kill app.document", these function have been
 * revised but is reverted back. If it is useful, need to Kill app.document
 * again.
AOM.AmgGalleryMaker.currentTemplate = function ()
{
    return AOM.AmgTemplateSection.currentTemplate();
}  
AOM.AmgGalleryMaker.currentStyle = function ()
{
	var style = AOM.AmgStyleSection.currentStyle();
	if (style == undefined)
		style = AOM.AmgGalleryMaker.defaultStyle();
	if (style == undefined)
		AOM.AMG.Log.writeError("AOM.AmgGalleryMaker.currentStyle - no current or default style");
	return style;
} */
AOM.AmgGalleryMaker.defaultTemplate = function ()
{
    // the default template is the first in the list
    for (var i in AOM.AmgGalleryMaker.templates)
    {
        return i;
    }
	AOM.AMG.Log.writeError("GalleryMaker.defaultTemplate - no templates");
    return undefined;
}
AOM.AmgGalleryMaker.defaultStyle = function (doc, template)
{
	// the default style is the first in the list
	if (template == undefined)
		template = AOM.AmgTemplateSection.currentTemplate(doc);
	if (template == undefined)
		AOM.AMG.Log.writeError("AOM.AmgGalleryMaker.defaultStyle - no current template");
	var styles = AOM.AmgGalleryMaker.templates[template].styles;
	for (var i in styles)
	{
		return i;
	}
	AOM.AMG.Log.writeError("GalleryMaker.defaultStyle - no styles for template ("+template+")");
	return undefined;
}
AOM.AmgGalleryMaker.styleList = function (doc, template)
{
	// return array of style/name items
	var styles = AOM.AmgGalleryMaker.templates[AOM.AmgTemplateSection.currentTemplate(doc)].styles;
	var folderPath = AOM.AMG.Paths.persistUserStylePath + template + "/";
	var templateFolder = new Folder(folderPath);
	var files = templateFolder.getFiles();
	
	var styleList = new Array();
	var styleNumber = 0;
	for (var j = 0; j < files.length; j++) {
		if (files[j].name.substr(files[j].name.length - 5, 5) == ".json") {
			var item = {};
			item.id = File.decode(files[j].name.substr(0, files[j].name.length - 5));
			item.name = File.decode(files[j].name.substr(0, files[j].name.length - 5));
			styleList.push(item);
			styleNumber++;
		}
	}
	
	if (styleNumber > 0) {
		var separator = {};
		separator.id = "-";
		separator.name = "-";
		styleList.push(separator);
	}
	
	for (var i in styles)
	{
		/*if (styleList == undefined)
			styleList = {};*/
		var presetItem = {};
		presetItem.id = i;
		presetItem.name = styles[i].name;
		styleList.push(presetItem);
	}
	return styleList;
}
AOM.AmgGalleryMaker.updateUserInputFromDefaults = function (overwrite, doc)
{
	// TODO - use an external file (JSON or XML) to specify
	// additional default values. E.g., the first time through
	// the Flash template, Gallery Title should default to
	// Adobe Media Gallery. In the case of 01_default_st, this
	// value is not specified in gallerymaker.xml or 05darkroom.xml.
	var defaultValues = [
		{path:"metadata.siteTitle",			value:"Adobe Web Gallery"},
		{path:"metadata.groupTitle",		value:AOM.AMG.localize("$$$/MediaGallery/JavaScript/GalleryMaker/Metadata/GroupTitle=My Photographs")},
		{path:"metadata.groupDescription",	value:AOM.AMG.localize("$$$/MediaGallery/JavaScript/GalleryMaker/Metadata/GroupDescription=Web Photo Gallery created by Adobe Bridge")},
		{path:"metadata.contactName",		value:AOM.AMG.localize("$$$/MediaGallery/JavaScript/GalleryMaker/Metadata/ContactName=Contact name")},
		{path:"metadata.contactEmail",		value:"user@domain.com"},
		{path:"metadata.copyrightInfo",     value:""},
		{path:"appearance.slideShowSize.size",  value:675},
		{path:"appearance.galleryShowSize.size",  value:450},
		{path:"appearance.thumbnailShowSize.size",  value:24},
		{path:"appearance.htmlPreviewSize.size",  value:300},
		{path:"appearance.caption.customtext", value:""},
		{path:"agmSizes.large.width", value:640},
		{path:"appearance.jpegQuality.value", value:70},
		{path:"appearance.showFileName.display",  value:false},
		{path:"appearance.showExtension.display",  value:false}
	];
	var currentUserInput = AOM.AMG.userInput(doc);
	for (var i = 0; i < defaultValues.length; i++)
	{
		var dvi = defaultValues[i]; // default value item
		var id = AOM.AmgGalleryMaker.idFromPath(dvi.path, doc);
		if (overwrite == false && currentUserInput.get(id) != undefined)
			continue; // if there is a value for this id, skip
		currentUserInput.set(id, dvi.value);
	}
}
AOM.AmgGalleryMaker.loadTemplate = function (template, doc)
{
	var error = function (s) {return AOM.AMG.Log.writeError("AOM.AmgGalleryMaker.loadTemplate - " + s);}
	
	if (template == undefined) return error("template not defined");
	
	var result = AOM.AmgGalleryMaker.processGalleryMakerXml(template, doc);
    if (result == undefined)
        return error("processGalleryMakerXml failed");
	
	AOM.AmgGalleryMaker.updateUserInputFromModels("galleryMaker", false, false, doc);
	AOM.AmgGalleryMaker.updateUserInputFromDefaults(false, doc);
	AOM.AmgGalleryMaker.initializeIdTranslations(doc);
}
AOM.AmgGalleryMaker.loadStyle = function (template, style, overwrite, doc)
{
	var error = function (s) {return AOM.AMG.Log.writeError("AOM.AmgGalleryMaker.loadStyle - " + s);}

	if (style == undefined) return error("style not defined");
	
    result = AOM.AmgGalleryMaker.processStyleXml(template, style, doc);
    if (result == undefined)
        return error("processStyleXml failed");
	AOM.AmgGalleryMaker.updateUserInputFromModels("style", overwrite, true, doc);
}
AOM.AmgGalleryMaker.processGalleryMakerXml = function (template, doc)
{
	var error = function (s) {return AOM.AMG.Log.writeError("AOM.AmgGalleryMaker.processGalleryMakerXml - " + s);}

	if (template == undefined) return error("template undefined");
	
	var templateFolder = new Folder(AOM.AmgGalleryMaker.templatePath(template));
	if (!templateFolder.exists)	return error("template folder does not exist ("+templateFolder.fsName+")");

    targetFolderName = AOM.AMG.userFolder(doc);
    targetFolder = new Folder(targetFolderName);
    if(!targetFolder.exists)
        targetFolder.create();

	var files = [
		{xml: templateFolder + "/gallerymaker.xml", xslt: AOM.AMG.Paths.scripts + "gallerymakerFlash.xslt", out: targetFolderName + "gallerymaker.json", json: true},
		{xml: templateFolder + "/gallerymaker.xml", xslt: AOM.AMG.Paths.scripts + "gallerymakerFlash_galleryInfo.xslt", out: targetFolderName + "galleryInfo.xml", json: false}
	];
	try
	{
		AOM.AmgGalleryMaker.currentDocument = doc;
		AOM.AmgGalleryMaker.processXml(files, "processGalleryMakerXml");
		AOM.AmgGalleryMaker.currentDocument = undefined;
		AOM.AmgGalleryMaker.makeBindingMaps(doc);
	}
	catch (e)
	{
		return AOM.AMG.Log.writeError(e);
	}
	return true;
}
AOM.AmgGalleryMaker.processStyleXml = function (template, style, doc)
{
	var error = function (s) {return AOM.AMG.Log.writeError("AOM.AmgGalleryMaker.processStyleXml - " + s);}
	
	if (template == undefined) return error("template undefined");
	if (style == undefined) return error("style undefined");
	var stylePath = AOM.AmgGalleryMaker.stylePath(template, style); if (stylePath == undefined) return error("style path undefined");
	//AOM.AMG.Log.writeLine("processStyleXml - "+stylePath);
	
	var styleFile = new File(stylePath);
	if (!styleFile.exists) return error("style file does not exist ("+styleFile.fsName+")");
	
	var targetFolderName = AOM.AMG.userFolder(doc);
    targetFolder = new Folder(targetFolderName);
    if(!targetFolder.exists)
        targetFolder.create();

	var files = [
		{xml: styleFile.fsName, xslt: AOM.AMG.Paths.scripts + "styleFlash.xslt", out: targetFolderName + "style.json", json: true},
		{xml: styleFile.fsName, xslt: AOM.AMG.Paths.scripts + "styleFlash_galleryStyle.xslt", out: targetFolderName + "galleryStyle.xml", json: false}
	];
	try
	{
		AOM.AmgGalleryMaker.currentDocument = doc;
		AOM.AmgGalleryMaker.processXml(files, "processStyleXml");
		AOM.AmgGalleryMaker.currentDocument = undefined;
		AOM.AMG.localizeFile(new File(targetFolderName + "galleryStyle.xml"));
	}
	catch (e)
	{
		return AOM.AMG.Log.writeError(e);
	}
	return true;
}
AOM.AmgGalleryMaker.enableJsonFormat = true;
AOM.AmgGalleryMaker.processXml = function (files, caller)
{
	try
	{
		for (var i = 0; i < files.length; i++)
		{
			var xml = new File(files[i].xml);
			var xslt = new File(files[i].xslt);
			var out = new File(files[i].out);
			if (AOM.AMG.Xslt.transform(xml, xslt, out))
			{
				if (files[i].json)
				{
					if (AOM.AmgGalleryMaker.enableJsonFormat)
						AOM.AmgGalleryMaker.formatJson(out);
					AOM.AmgGalleryMaker.eval(out);
				}
			}
			else
				throw ("GalleryMaker." + caller + " - transform failed");
		}
	}
	catch (e)
	{
		throw ("GalleryMaker." + caller + " - caught: " + e);
	}
}
AOM.AmgGalleryMaker.updateUserInputFromModels = function (requestedModel, overwrite, markUpdate, doc)
{
	var currentUserInput = AOM.AMG.userInput(doc);
    //currentUserInput.cleanUpdateMark(requestedModel);
    var galleryMakerData = AOM.AMG.galleryMakerData(doc);
    
	var model = galleryMakerData.models[requestedModel];
	if (model == undefined)
		return AOM.AMG.Log.writeError("updateUserInputFromModels - requested model unknown");
		
	for (var j = 0; j < model.length; j++)
	{
		mi = model[j]; // model item
		if (mi.value == "")
			continue;
		var id = AOM.AmgGalleryMaker.idFromPath(mi.path, doc);
		if (id == undefined)
			continue;
		/*if(markUpdate == true)
		    currentUserInput.set(id + "_" + requestedModel + "_Modified", "true");*/
		if (overwrite == false && currentUserInput.get(id) != undefined)
			continue; // if there is a value for this id, skip
		currentUserInput.set(id, mi.value);
	}
}
AOM.AmgGalleryMaker.formatJson = function (file)
{
	// Format some JSON code. The XSLT output is not so easy
	// to read. This routine formats the XSLT output in an effort
	// to improve legibility. Creates a second file with an underscore
	// appended to the extension...
	var openOutputFile = function (file)
	{
		var outFile = new File(file.fsName + "_");
		outFile.lineFeed = "unix";
		if (!outFile.open("w", "TEXT", "????"))
		{
			return undefined;
		}
		return outFile;
	}
	var makeIndent = function (count)
	{
		var indent = "";
		for (var i = 0; i < count; i++)
		{
			indent += "	";
		}
		return indent;
	}
	if (file instanceof File)
	{
		if (file.exists)
		{
			if (file.open("r"))
			{
				var outFile = openOutputFile(file);
				if (outFile == undefined)
				{
					file.close();
					return;
				}
				var indent = 0;
				var line = file.readln();
				while (!file.eof)
				{
					// remove whitespace
					line = line.amgTrim();
					// skip blank lines
					if (line.length > 0)
					{
						// if line starts with ']' decrease indent
						if (line.substr(0, 1) == ']')
							indent--;
						// write line with current indent
						outFile.writeln(makeIndent(indent) + line);
						// if line ends with '[' increase indent
						if (line.substr(line.length-1, 1) == '[')
							indent++;
					}
					line = file.readln();
				}
				outFile.close();
			}
			else
				AOM.AMG.Log.writeError("could not open " + file.fsName);
			file.close();
		}
		else
			AOM.AMG.Log.writeError("GalleryMaker.eval - file does not exist");
	}
	else
		AOM.AMG.Log.writeError("GalleryMaker.eval - file not file");
}
AOM.AmgGalleryMaker.makeBindingMaps = function (doc)
{
    var galleryMakerData = AOM.AMG.galleryMakerData(doc);

	galleryMakerData.bindings.destinationToSource = {}
	for (var i = 0; i < galleryMakerData.bindings.length; i++)
	{
		var bi = galleryMakerData.bindings[i]; // binding item
		galleryMakerData.bindings.destinationToSource[bi.destination] = bi.source;
	}
}
AOM.AmgGalleryMaker.idFromPath = function (path, document)
{
    var galleryMakerData = AOM.AMG.galleryMakerData(document);
	var value = galleryMakerData.bindings.destinationToSource[path];
	if (value == undefined)
		return undefined;
	var itemList = value.split(".");
	// for now assume that the id is the first item in the list
	if (itemList.length > 0)
		return itemList[0];
	return undefined;
}
AOM.AmgGalleryMaker.eval = function (file)
{
	if (file instanceof File)
	{
		if (file.exists)
		{
			if (file.open("r"))
			{
				var contents = file.read();
				file.close();
				try
				{
					eval(contents);
				}
				catch (e)
				{
					AOM.AMG.Log.writeError(e);
				}
			}
			else
				AOM.AMG.Log.writeError("could not open " + file.fsName);
		}
		else
			AOM.AMG.Log.writeError("GalleryMaker.eval - file does not exist");
	}
	else
		AOM.AMG.Log.writeError("GalleryMaker.eval - file not file");
}
AOM.AmgGalleryMaker.get = function (id, document)
{
	var translatedId = AOM.AMG.galleryMakerData(document).idTranslations[id];
    
	if (translatedId != undefined) {
		var value = AOM.AMG.userInput(document).get(translatedId);
		if (AOM.AMG.Tests.isNumber(value)) {
			return value;
		} else {
			return AOM.AmgUserInput.htmlEncoding(value);
		}
	}

	AOM.AMG.Log.writeError("UserInput.idTranslations[" + id + "] was undefined");
	return "_idTranslationUndefined";
}
AOM.AmgGalleryMaker.set = function(id, value, document) 
{
	var translatedId = AOM.AMG.galleryMakerData(document).idTranslations[id];
	
	if (translatedId != undefined) {
		AOM.AMG.userInput(document).set(translatedId, value);
	}
}

AOM.AmgGalleryMaker.templates = undefined;
AOM.AmgGalleryMaker.processTemplatesAndStyles = function ()
{
	var error = function (s) {return AOM.AMG.Log.writeError("GalleryMaker.processTemplatesAndStyles - " + s);}

	if (AOM.AmgGalleryMaker.templates == undefined)
	{
		var templateFolder = new Folder(AOM.AMG.Paths.templates);
		if (!templateFolder.exists)
			return error("folder not found ("+templateFolder.fsName+")");

		// At the moment we assume every folder is a template folder...
		templateFolderContents = templateFolder.getFiles();
		for (var i = 0; i < templateFolderContents.length; i++)
		{
			var folder = templateFolderContents[i];
			if (folder instanceof Folder == false)
				continue;
			// look for a gallermaker.xml file
			var files = folder.getFiles("gallerymaker.xml");
			if (files == null || files.length != 1)
			{
				error("gallerymaker.xml not found in '"+folder.fsName+"'");
				continue;
			}
			galleryMaker = files[0];
			var nd = AOM.AmgGalleryMaker.galleryMakerNameDescription(galleryMaker); // name/description pair
			if (nd == undefined)
				continue;
			// NOTE - If there is problem with a template's styles the template is skipped. Is that
			// okay? Or should we deal with it upstream?
			var styles = AOM.AmgGalleryMaker.processStyles(folder);
			if (styles == undefined)
				continue;
			if (AOM.AmgGalleryMaker.templates == undefined)
				AOM.AmgGalleryMaker.templates = {};
			AOM.AmgGalleryMaker.templates[folder.name] = {name: nd.name, description: nd.description, styles: styles};
		}
	}
	else
		AOM.AMG.Log.writeError("GalleryMaker.processTemplatesStyles - AOM.AmgGalleryMaker.templates already exists");
}
AOM.AmgGalleryMaker.initializeIdTranslations = function (doc)
{
	var currentMakerData = AOM.AMG.galleryMakerData(doc);
	var lightroom = (currentMakerData.models.identifier == "com.adobe.wpg.flash.bluefire1" ? true : false);
	currentMakerData.idTranslations = {};
	var itl = currentMakerData.idTranslations; // id translation list
	itl.fvl_template				= "t_template";
	itl.fvl_stylexml				= "si_style";
	itl.fvl_windowTitle				= "cg_galleryText";
	itl.fvl_galleryName				= "cg_galleryText";
	itl.fvl_galleryDescription		= lightroom ? "groupTitle"		 : "groupDescriptionView";
	itl.fvl_siteTitle				= lightroom ? "siteTitle"		 : "siteTitleView",
	itl.fvl_groupTitle				= lightroom ? "groupTitle"		 : "groupTitleView",
	itl.fvl_groupDescription		= lightroom ? "groupDescription" : "groupDescriptionView",
	itl.fvl_contactName				= lightroom ? "contactInfoName"	 : "contactNameView",
	itl.fvl_contactEmail			= lightroom ? "contactInfoLink"	 : "contactEmailView"
	itl.fvl_copyright				= "copyrightView";
	itl.fvl_thumbnailSize			= "io_thumbnail_size";
    itl.fvl_galleryShowSize			= "io_gallery_show_size";
    itl.fvl_slideShowSize			= "io_slide_show_size";
	itl.fvl_captionWidthPercentView		= "captionWidthPercentView";
	itl.fvl_captionWidthPercentViewDisplay  = "captionWidthPercentView_display";
	itl.fvl_showTitleViewJournal			= "showTitleViewJournal";
}
AOM.AmgGalleryMaker.processStyles = function (templateFolder)
{
	var error = function (s) {return AOM.AMG.Log.writeError("GalleryMaker.processStyles - " + s);}

	var templateFolderContents = templateFolder.getFiles("styles");
	if (templateFolderContents == null || templateFolderContents.length != 1)
		return error("could not find styles folder");
	var styleFolder = templateFolderContents[0];
	if (styleFolder instanceof Folder == false)
		return error("styleFolder is not a folder (" + styleFolder + ")");
	var styleFolderContents = styleFolder.getFiles("*.xml");
	if (styleFolderContents == null)
		return error("could not find xml files");

	var styles = undefined;
	for (var i = 0; i < styleFolderContents.length; i++)
	{
		var styleFile = styleFolderContents[i];
		if (styleFile instanceof File == false)
			continue;
		nd = AOM.AmgGalleryMaker.styleNameDescription(styleFile);
		if (nd == undefined)
			continue;
		if (styles == undefined)
			styles = {};
		styles[styleFile.name] = {name: nd.name, description: nd.description};
	}
	return styles;
}
AOM.AmgGalleryMaker.galleryMakerNameDescription = function (file)
{
	return AOM.AmgGalleryMaker.nameDescription(file, "gallery");
}
AOM.AmgGalleryMaker.styleNameDescription = function (file)
{
	return AOM.AmgGalleryMaker.nameDescription(file, "style");
}
AOM.AmgGalleryMaker.nameDescription = function (file, tag)
{
	// get the name and description from a gallerymaker.xml file
	// TODO - extend XSLT object to take the xslt as a string and return the result as a string...
	var error = function (s) {AOM.AMG.Log.writeError("GalleryMaker.nameDescription - " + s); return undefined;}

	if (file instanceof File == false) {return error("file not a file");}
	if (!file.exists) {return error("file does not exist (" + file.fsName + ")");}
	if (!file.open("r")) {return error("could not open file (" + file.fsName + ")");}

	var name = null;
	var nameRegex = new RegExp("<"+tag+"Name>.*</"+tag+"Name>");
	var description = null;
	var descriptionRegex = new RegExp("<"+tag+"Description>.*</"+tag+"Description>");
	var line = file.readln();
	while (!file.eof)
	{
		if (name == null)
			name = line.match(nameRegex);
		if (description == null)
			description = line.match(descriptionRegex);
		if (name == null || description == null)
			line = file.readln();
		else
			break;
	}
	file.close();
	if (name != null && description != null)
	{
		var clean = function (text, tag)
		{
			// remove tag and quotes
			text = text.replace("<"+tag+">", "");
			text = text.replace("</"+tag+">", "");
			quotes = new String("'\"");
			if (quotes.indexOf(text.substr(0, 1)) != -1) // is the first character a single or double quote?
				text = text.substr(1, text.length-2); // yes, so strip off first and last characters
			return text;
		}
		return {'name': AOM.AMG.localize(clean(name[0], tag+"Name")), 'description': AOM.AMG.localize(clean(description[0], tag+"Description"))};
	}
	else
		error("file missing name or description (" + file.fsName + ")");
	return undefined;
}
AOM.AmgGalleryMaker.imageSizes = function ()
{
	return AOM.AmgGalleryMaker.sizes.values;
}
AOM.AmgGalleryMaker.loadTemplateDropdown = function (dropdown, selectedTemplate)
{
	if (dropdown instanceof DropDownList == false)
		return AOM.AMG.Log.writeError("AOM.AmgGalleryMaker.templateList - dropdown not DropDownList");
	if (AOM.AmgGalleryMaker.templates == undefined)
		return AOM.AMG.Log.writeError("AOM.AmgGalleryMaker.templateList - templates undefined");

	for (var i in AOM.AmgGalleryMaker.templates)
	{
		var listItem = dropdown.add("item", AOM.AmgGalleryMaker.templates[i].name);
		if (i == selectedTemplate)
			listItem.selected = true;
		listItem.template = i;
	}
}
AOM.AmgGalleryMaker.listStyles = function (template)
{
	var styles = AOM.AmgGalleryMaker.templates[template].styles;
	for (var i in styles)
	{
		AOM.AMG.Log.writeLine(i + " - " + styles[i].name);
	}
}
AOM.AmgGalleryMaker.imageSizes = {};
AOM.AmgGalleryMaker.imageSizes.small = {};	
AOM.AmgGalleryMaker.imageSizes.small.largeMax			= 675;
AOM.AmgGalleryMaker.imageSizes.small.mediumMax			= 450;
AOM.AmgGalleryMaker.imageSizes.small.smallMax			= 300;
AOM.AmgGalleryMaker.imageSizes.small.thumbnailMax		= 24;
AOM.AmgGalleryMaker.imageSizes.medium = {};	
AOM.AmgGalleryMaker.imageSizes.medium.largeMax			= 780;
AOM.AmgGalleryMaker.imageSizes.medium.mediumMax			= 675;
AOM.AmgGalleryMaker.imageSizes.medium.smallMax			= 480;
AOM.AmgGalleryMaker.imageSizes.medium.thumbnailMax		= 48;
AOM.AmgGalleryMaker.imageSizes.large = {};	
AOM.AmgGalleryMaker.imageSizes.large.largeMax			= 1024;
AOM.AmgGalleryMaker.imageSizes.large.mediumMax			= 768;
AOM.AmgGalleryMaker.imageSizes.large.smallMax			= 450;
AOM.AmgGalleryMaker.imageSizes.large.thumbnailMax		= 96;
AOM.AmgGalleryMaker.imageSizes.extraLarge = {};	
AOM.AmgGalleryMaker.imageSizes.extraLarge.largeMax		= 1600;
AOM.AmgGalleryMaker.imageSizes.extraLarge.mediumMax		= 1024;
AOM.AmgGalleryMaker.imageSizes.extraLarge.smallMax		= 768;
AOM.AmgGalleryMaker.imageSizes.extraLarge.thumbnailMax	= 192;
