/**
 * Fotolia license
 *
 * @copyright (c) 2004-2008, SWsoft
 */
function InitLicense(containerId, inputId, name, price, resolutionInfo) {
	var licenseObject = new FotoliaLicense(name);
	licenseObject.price = price;
	licenseObject.resolutionInfo = resolutionInfo;

	var radioControl = $(inputId);
	var nextButtonControl = $('fotoliaNextButton');
	var selectLicenseMethod = function() {
		self.parent.fotoliaPurchaseImageFormManager.setLicense(licenseObject);
		enableButton(nextButtonControl);
	};
	if (radioControl.checked) {
		selectLicenseMethod();
	}

	Event.observe(
		$(inputId),
		'click',
		selectLicenseMethod
	);

	Event.observe(
		$(containerId),
		'click',
		function() {
			radioControl.checked = true;
			selectLicenseMethod();
		}
	);
}

function updateFotoliaLicenseFormSize(contentWidht, contentHeight, imageWidth, imageHeight) {
	var width = contentWidht;
	var height = contentHeight;

	var maxDimensions = self.parent.fotoliaPurchaseImageFormManager.getMaxDimensions();
	if ((height + imageHeight) > (maxDimensions.height - 40)) {
		height = 560;
		var imageContainer = $('fotoliaLicenseImageContainer');
		imageContainer.style.height = '320px';
		imageContainer.style.overflow = 'auto';
	} else {
		height += imageHeight;
	}

	self.parent.fotoliaPurchaseImageFormManager.changeFormSize(width, height);
}

var FotoliaLicense = Class.create();
FotoliaLicense.prototype = {

	/**
	 * License name
	 *
	 * @var string
	 * @access public
	 */
	name: null,

	/**
	 * License price
	 *
	 * @var string
	 * @access public
	 */
	price: null,

	/**
	 * License resolution info
	 *
	 * @var string
	 * @access public
	 */
	resolutionInfo: null,

	/**
	 * Object constructor
	 *
	 * @access public
	 * @param string
	 * @return void
	 */
	initialize: function(name) {
		this.name = name;
	}
}