﻿Type.registerNamespace('Inductronic');Inductronic.CalendarBehavior = function(element) {
Inductronic.CalendarBehavior.initializeBase(this, [element]);this._loaded = false;this._eventsAttached = false;this._calendarImageBehaviours = null;this._currentCalendar = null;this._monthsArray = null;this._previewBehavior = null;this._isEnabled = false;this._imageRecipe = '';this._imagePreviewRecipe = '';this._loadingImageUrl = '';this._preloadImageUrl = '';this._servicePath = '';this._previewImagesUrl = '';this._startMonth = 0;this._minMonth = 0;this._maxMonth = 0;this._startYear = 0;this._minYear = 0;this._maxYear = 0;this._months = '';this._clearConfirmMessage = '';this._cartNameTitle = '';this._cartNameDefault = '';this._formatTitle = '';this._startMonthTitle = '';this._clearTitle = '';this._imageTextTitle = '';this._cartInfoTitle = '';this._minimumQuantity = '';this._pricePrefix = '';this._price = '';this._addToCartTitle = '';this._addToCartCompleteMessage = '';this._helpTitle = '';this._formatA3Title = '';this._formatA4Title = '';this._formatA5Title = '';this._enableA5 = false;this._onImageManagerRotateDelegate = null;this._onImageManagerDeleteDelegate = null;this._onImageManagerLoadedDelegate = null;this._onFormatChangedDelegate = null;this._onStartMonthChangedDelegate = null;this._onCalendarLoadedDelegate = null;this._onImageClickExternalDelegate = null;this._onImageChangedExternalDelegate = null;this._onClearClickDelegate = null;this._onImageTextClickDelegate = null;this._onHelpClickDelegate = null;this._onAddToCartClickDelegate = null;this._onAddToCartCompleteDelegate = null;this._onCalendarRefreshDelegate = null;this._onCalendarValidateDelegate = null;this._previewDiv = null;this._previewImage = null;this._previewMonthImage = null;this._cartNameInput = null;this._formatSelect = null;this._startMonthSelect = null;this._monthList = null;this._clearAnchor = null;this._imageTextAnchor = null;this._helpAnchor = null;this._quantityInput = null;this._addToCartAnchor = null;}
Inductronic.CalendarBehavior.prototype = {
initialize: function() {
Inductronic.CalendarBehavior.callBaseMethod(this, 'initialize');this._monthsArray = this._months.split(';');var el = this.get_element();this._previewDiv = document.createElement('div');el.appendChild(this._previewDiv);Sys.UI.DomElement.addCssClass(this._previewDiv, 'cala3');this._previewImage = document.createElement('img');this._previewDiv.appendChild(this._previewImage);this._previewImage.id = this._generateId('preview');this._previewImage.alt = '';Sys.UI.DomElement.addCssClass(this._previewImage, 'picturea3');$common.setVisible(this._previewImage, false);this._previewMonthImage = document.createElement('img');this._previewDiv.appendChild(this._previewMonthImage);this._previewMonthImage.alt = '';Sys.UI.DomElement.addCssClass(this._previewMonthImage, 'previewmonth');$common.setVisible(this._previewMonthImage, false);var monthsDiv = document.createElement('div');el.appendChild(monthsDiv);Sys.UI.DomElement.addCssClass(monthsDiv, 'months');var choicesDiv1 = document.createElement('div');monthsDiv.appendChild(choicesDiv1);Sys.UI.DomElement.addCssClass(choicesDiv1, 'choices');var cartNameLabel = document.createElement('label');choicesDiv1.appendChild(cartNameLabel);cartNameLabel.innerHTML = this._cartNameTitle;this._cartNameInput = document.createElement('input');choicesDiv1.appendChild(this._cartNameInput);this._cartNameInput.id = this._generateId('name');this._cartNameInput.type = 'text';this._cartNameInput.maxlength = 50;this._cartNameInput.value = this._cartNameDefault;cartNameLabel.htmlFor = this._cartNameInput.id;var choicesDiv2 = document.createElement('div');monthsDiv.appendChild(choicesDiv2);Sys.UI.DomElement.addCssClass(choicesDiv2, 'choices');var formatNameLabel = document.createElement('label');choicesDiv2.appendChild(formatNameLabel);formatNameLabel.innerHTML = this._formatTitle;this._formatSelect = document.createElement('select');choicesDiv2.appendChild(this._formatSelect);this._formatSelect.id = this._generateId('format');formatNameLabel.htmlFor = this._formatSelect.id;var choicesDiv3 = document.createElement('div');monthsDiv.appendChild(choicesDiv3);Sys.UI.DomElement.addCssClass(choicesDiv3, 'choices last');var startMonthNameLabel = document.createElement('label');choicesDiv3.appendChild(startMonthNameLabel);startMonthNameLabel.innerHTML = this._startMonthTitle;this._startMonthSelect = document.createElement('select');choicesDiv3.appendChild(this._startMonthSelect);this._startMonthSelect.id = this._generateId('startmonth');startMonthNameLabel.htmlFor = this._startMonthSelect.id;var clearDiv = document.createElement('div');monthsDiv.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');this._monthList = document.createElement('ul');monthsDiv.appendChild(this._monthList);Sys.UI.DomElement.addCssClass(this._monthList, 'month_list');clearDiv = document.createElement('div');monthsDiv.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');var optionsDiv = document.createElement('div');monthsDiv.appendChild(optionsDiv);Sys.UI.DomElement.addCssClass(optionsDiv, 'options');current = document.createElement('div');optionsDiv.appendChild(current);Sys.UI.DomElement.addCssClass(current, 'button std');this._clearAnchor = document.createElement('a');current.appendChild(this._clearAnchor);this._clearAnchor.href = '';this._clearAnchor.innerHTML = String.format('<span class="clear">{0}</span>', this._clearTitle);current = document.createElement('div');optionsDiv.appendChild(current);Sys.UI.DomElement.addCssClass(current, 'button');this._imageTextAnchor = document.createElement('a');current.appendChild(this._imageTextAnchor);this._imageTextAnchor.href = '';this._imageTextAnchor.innerHTML = this._imageTextTitle;current = document.createElement('div');optionsDiv.appendChild(current);Sys.UI.DomElement.addCssClass(current, 'cartinfo');var cartInfoLabel = document.createElement('label');current.appendChild(cartInfoLabel);cartInfoLabel.innerHTML = this._cartInfoTitle;this._quantityInput = document.createElement('input');current.appendChild(this._quantityInput);this._quantityInput.id = this._generateId('quantity');this._quantityInput.type = 'text';this._quantityInput.maxlength = 3;this._quantityInput.value = this._minimumQuantity;cartInfoLabel.htmlFor = this._quantityInput.id;var currentP = document.createElement('p');current.appendChild(currentP);currentP.innerHTML = String.format('{0} <span>{1}</span>', this._pricePrefix, this._price);current = document.createElement('div');optionsDiv.appendChild(current);Sys.UI.DomElement.addCssClass(current, 'button fancy');this._addToCartAnchor = document.createElement('a');current.appendChild(this._addToCartAnchor);this._addToCartAnchor.href = '';this._addToCartAnchor.innerHTML = String.format('<span class="cart">{0}</span>', this._addToCartTitle);clearDiv = document.createElement('div');optionsDiv.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');clearDiv = document.createElement('div');el.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');this._helpAnchor = document.createElement('a');el.appendChild(this._helpAnchor);this._helpAnchor.href = '';this._helpAnchor.innerHTML = this._helpTitle;Sys.UI.DomElement.addCssClass(this._helpAnchor, 'help');this._handleDelegates(true);this._handleEvents(true);var applicationManager = this.get_applicationManager();applicationManager.add_loaded(this._onImageManagerLoadedDelegate);applicationManager.add_rotate(this._onImageManagerRotateDelegate);applicationManager.add_delete(this._onImageManagerDeleteDelegate);this._enableDisableCommands(true);},
dispose: function() {
$clearHandlers(this.get_element());var applicationManager = this.get_applicationManager();if (applicationManager) {
applicationManager.remove_loaded(this._onImageManagerLoadedDelegate);applicationManager.remove_rotate(this._onImageManagerRotateDelegate);applicationManager.remove_delete(this._onImageManagerDeleteDelegate);}
this._handleEvents(false);this._handleDelegates(false);Inductronic.CalendarBehavior.callBaseMethod(this, 'dispose');},
get_applicationManager: function() {
return Inductronic.ApplicationManagerBehavior.getInstance();},
_handleEvents: function(attach) {
if (attach === true && this._eventsAttached === false) {
this._eventsAttached = true;$addHandler(this._formatSelect, 'change', this._onFormatChangedDelegate);$addHandler(this._startMonthSelect, 'change', this._onStartMonthChangedDelegate);$addHandler(this._clearAnchor, 'click', this._onClearClickDelegate);$addHandler(this._imageTextAnchor, 'click', this._onImageTextClickDelegate);$addHandler(this._helpAnchor, 'click', this._onHelpClickDelegate);$addHandler(this._addToCartAnchor, 'click', this._onAddToCartClickDelegate);}
else if (this._eventsAttached === true) {
$removeHandler(this._formatSelect, 'change', this._onFormatChangedDelegate);$removeHandler(this._startMonthSelect, 'change', this._onStartMonthChangedDelegate);$removeHandler(this._clearAnchor, 'click', this._onClearClickDelegate);$removeHandler(this._imageTextAnchor, 'click', this._onImageTextClickDelegate);$removeHandler(this._helpAnchor, 'click', this._onHelpClickDelegate);$removeHandler(this._addToCartAnchor, 'click', this._onAddToCartClickDelegate);this._eventsAttached = false;}
},
_handleDelegates: function(attach) {
if (attach === true) {
if (this._onImageManagerRotateDelegate === null) {
this._onImageManagerRotateDelegate = Function.createDelegate(this, this._onImageManagerRotateEvent);}
if (this._onImageManagerDeleteDelegate === null) {
this._onImageManagerDeleteDelegate = Function.createDelegate(this, this._onImageManagerDeleteEvent);}
if (this._onImageManagerLoadedDelegate === null) {
this._onImageManagerLoadedDelegate = Function.createDelegate(this, this._onImageManagerLoadedEvent);}
if (this._onFormatChangedDelegate === null) {
this._onFormatChangedDelegate = Function.createDelegate(this, this._onFormatChangedEvent);}
if (this._onStartMonthChangedDelegate === null) {
this._onStartMonthChangedDelegate = Function.createDelegate(this, this._onStartMonthChangedEvent);}
if (this._onCalendarLoadedDelegate === null) {
this._onCalendarLoadedDelegate = Function.createDelegate(this, this._onCalendarLoadedEvent);}
if (this._onImageClickExternalDelegate === null) {
this._onImageClickExternalDelegate = Function.createDelegate(this, this._onImageClickExternalEvent);}
if (this._onImageChangedExternalDelegate === null) {
this._onImageChangedExternalDelegate = Function.createDelegate(this, this._onImageChangedExternalEvent);}
if (this._onClearClickDelegate === null) {
this._onClearClickDelegate = Function.createDelegate(this, this._onClearClickEvent);}
if (this._onImageTextClickDelegate === null) {
this._onImageTextClickDelegate = Function.createDelegate(this, this._onImageTextClickEvent);}
if (this._onHelpClickDelegate === null) {
this._onHelpClickDelegate = Function.createDelegate(this, this._onHelpClickEvent);}
if (this._onAddToCartClickDelegate === null) {
this._onAddToCartClickDelegate = Function.createDelegate(this, this._onAddToCartClickEvent);}
if (this._onAddToCartCompleteDelegate === null) {
this._onAddToCartCompleteDelegate = Function.createDelegate(this, this._onAddToCartCompleteEvent);}
if (this._onCalendarRefreshDelegate === null) {
this._onCalendarRefreshDelegate = Function.createDelegate(this, this._onCalendarRefreshEvent);}
if (this._onCalendarValidateDelegate === null) {
this._onCalendarValidateDelegate = Function.createDelegate(this, this._onCalendarValidateEvent);}
}
else {
if (this._onImageManagerRotateDelegate) {
delete this._onImageManagerRotateDelegate;this._onImageManagerRotateDelegate = null;}
if (this._onImageManagerDeleteDelegate) {
delete this._onImageManagerDeleteDelegate;this._onImageManagerDeleteDelegate = null;}
if (this._onImageManagerLoadedDelegate) {
delete this._onImageManagerLoadedDelegate;this._onImageManagerLoadedDelegate = null;}
if (this._onFormatChangedDelegate) {
delete this._onFormatChangedDelegate;this._onFormatChangedDelegate = null;}
if (this._onStartMonthChangedDelegate) {
delete this._onStartMonthChangedDelegate;this._onStartMonthChangedDelegate = null;}
if (this._onCalendarLoadedDelegate) {
delete this._onCalendarLoadedDelegate;this._onCalendarLoadedDelegate = null;}
if (this._onImageClickExternalDelegate) {
delete this._onImageClickExternalDelegate;this._onImageClickExternalDelegate = null;}
if (this._onImageChangedExternalDelegate) {
delete this._onImageChangedExternalDelegate;this._onImageChangedExternalDelegate = null;}
if (this._onClearClickDelegate) {
delete this._onClearClickDelegate;this._onClearClickDelegate = null;}
if (this._onImageTextClickDelegate) {
delete this._onImageTextClickDelegate;this._onImageTextClickDelegate = null;}
if (this._onHelpClickDelegate) {
delete this._onHelpClickDelegate;this._onHelpClickDelegate = null;}
if (this._onAddToCartClickDelegate) {
delete this._onAddToCartClickDelegate;this._onAddToCartClickDelegate = null;}
if (this._onAddToCartCompleteDelegate) {
delete this._onAddToCartCompleteDelegate;this._onAddToCartCompleteDelegate = null;}
if (this._onCalendarRefreshDelegate) {
delete this._onCalendarRefreshDelegate;this._onCalendarRefreshDelegate = null;}
if (this._onCalendarValidateDelegate) {
delete this._onCalendarValidateDelegate;this._onCalendarValidateDelegate = null;}
}
},
_generateId: function(id) {
return this.get_id() + '_' + id;},
_isCommandsEnabled: function() {
return this._isEnabled;},
_enableDisableCommands: function(enable) {
this._isEnabled = enable;},
_getQuerystring: function(key, default_) {
if (default_ == null) {
default_ = "";}
var search = unescape(location.search);if (search == "") {
return default_;}
search = search.substr(1);var params = search.split("&");for (var i = 0;i < params.length;i++) {
var pairs = params[i].split("=");if (pairs[0] == key) {
return pairs[1];}
}
return default_;},
_requestCalendar: function() {
var format = -1;var params = {};try {
var result = this._getQuerystring('type');if (result != null && result.length > 0) {
format = parseInt(result);}
}
catch (ex) { }
var params = { format: format };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'GetCurrentCalendar', false, params, this._onCalendarLoadedDelegate, null, null);},
_changeSelected: function(year, month, key) {
this._currentCalendar.SelectedYear = year;this._currentCalendar.SelectedMonth = month;var page = this._findPage(this._currentCalendar.SelectedYear, this._currentCalendar.SelectedMonth);var data = String.format('{0}:{1}', page.Year, page.Month);this._previewBehavior.set_data(data);var update = (key != null && key.length > 0 && page.Image != key);if (update) {
var params = { selectedYear: this._currentCalendar.SelectedYear, selectedMonth: this._currentCalendar.SelectedMonth, selectedKey: key };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'ChangeSelected', false, params, null, null, null);}
var behavior = this._findBehaviorByPage(page);if (update) {
page.Image = key;behavior.reset();behavior.set_key(page.Image);behavior.set_description(page.ImageText);behavior.update();}
if (page.Image != null && page.Image.length > 0) {
this._previewBehavior.reset();this._previewBehavior.set_key(page.Image);this._previewBehavior.set_description(page.ImageText);this._previewBehavior.update();} else {
this._previewBehavior.reset();}
if (!$common.getVisible(this._previewMonthImage)) {
$common.setVisible(this._previewMonthImage, true);}
this._previewMonthImage.src = String.format('{0}{1}_{2}_{3}.gif', this._previewImagesUrl, Sys.CultureInfo.CurrentCulture.name, page.Year, page.Month);},
_findBehaviorByPage: function(page) {
var result = null;var behavior = null;for (var index = 0;index < this._calendarImageBehaviours.length;index++) {
behavior = this._calendarImageBehaviours[index];if (String.format('{0}:{1}', page.Year, page.Month) == behavior.get_data()) {
result = behavior;break;}
}
return result;},
_findPage: function(year, month) {
var result = null;var page = null;for (var i = 0;i < this._currentCalendar.Pages.length;i++) {
page = this._currentCalendar.Pages[i];if (page.Year == year && page.Month == month) {
result = page;break;}
}
return result;},
_findPageByMonth: function(month) {
var result = null;var page = null;for (var i = 0;i < this._currentCalendar.Pages.length;i++) {
page = this._currentCalendar.Pages[i];if (page.Month == month) {
result = page;break;}
}
return result;},
applyImage: function(key) {
this._changeSelected(this._currentCalendar.SelectedYear, this._currentCalendar.SelectedMonth, key);},
applyImageText: function(value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12) {
var page = null;var behavior = null;page = this._findPageByMonth(1);page.ImageText = value1;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(2);page.ImageText = value2;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(3);page.ImageText = value3;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(4);page.ImageText = value4;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(5);page.ImageText = value5;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(6);page.ImageText = value6;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(7);page.ImageText = value7;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(8);page.ImageText = value8;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(9);page.ImageText = value9;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(10);page.ImageText = value10;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(11);page.ImageText = value11;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);page = this._findPageByMonth(12);page.ImageText = value12;behavior = this._findBehaviorByPage(page);behavior.set_description(page.ImageText);var params = { value1: value1, value2: value2, value3: value3, value4: value4, value5: value5, value6: value6, value7: value7, value8: value8, value9: value9, value10: value10, value11: value11, value12: value12 };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'SaveImageText', false, params, null, null, null);},
_onImageManagerRotateEvent: function(sender, args) {
var behavior = null;for (var index = 0;index < this._calendarImageBehaviours.length;index++) {
behavior = this._calendarImageBehaviours[index];if (args.key == behavior.get_key()) {
behavior.update();}
}
if (this._previewBehavior.get_key() == args.key) {
this._previewBehavior.update();}
},
_onImageManagerDeleteEvent: function(sender, args) {
var page = null;var behavior = null;for (var index = 0;index < this._calendarImageBehaviours.length;index++) {
behavior = this._calendarImageBehaviours[index];if (args.key == behavior.get_key()) {
behavior.reset();}
}
for (var i = 0;i < this._currentCalendar.Pages.length;i++) {
page = this._currentCalendar.Pages[i];if (args.key == page.Image) {
page.Image = '';page.ImageText = '';}
}
if (this._previewBehavior.get_key() == args.key) {
this._previewBehavior.reset();}
var params = { key: args.key };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'ResetMonth', false, params, null, null, null);},
_onImageClickExternalEvent: function(sender, args) {
if (this._isCommandsEnabled()) {
var parts = sender.get_data().split(':');this._changeSelected(parseInt(parts[0]), parseInt(parts[1]), sender.get_key());}
},
_onImageChangedExternalEvent: function(sender, args) {
var key = sender.get_key();var valid = (key != null && key.length > 0);if (this._isCommandsEnabled() && valid == true) {
var parts = sender.get_data().split(':');this._changeSelected(parseInt(parts[0]), parseInt(parts[1]), key);}
},
_onImageManagerLoadedEvent: function(sender, args) {
var self = this;if (this._loaded === false) {
this._loaded = true;if (Sys.Browser.agent == Sys.Browser.Safari) {
window.setTimeout(function() { self._requestCalendar();}, 80);} else {
this._requestCalendar();}
}
},
_onFormatChangedEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
var newFormat = this._formatSelect.value;this._currentCalendar.Format = newFormat;var params = { format: newFormat };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'ChangeFormat', false, params, null, null, null);this._initializeIllustration(this._currentCalendar.Format);}
},
_onStartMonthChangedEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
var newStartMonth = this._startMonthSelect.value;var parts = newStartMonth.split(':');this._currentCalendar.StartYear = parseInt(parts[0]);this._currentCalendar.StartMonth = parseInt(parts[1]);var params = { startYear: this._currentCalendar.StartYear, startMonth: this._currentCalendar.StartMonth };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'ChangeStartMonth', false, params, this._onCalendarRefreshDelegate, null, null);}
},
_onCalendarRefreshEvent: function(sender, args) {
if (sender != null) {
this._currentCalendar = sender;this._initializeCalendar();}
},
_onCalendarLoadedEvent: function(sender, args) {
if (sender != null) {
this._currentCalendar = sender;this._initializeFormat(this._currentCalendar.Format);this._initializeStartMonth();this._initializeCalendar();this._initializeIllustration(this._currentCalendar.Format);this._changeSelected(this._currentCalendar.SelectedYear, this._currentCalendar.SelectedMonth, '');}
},
_onClearClickEvent: function(evt) {
evt.preventDefault();if (confirm(this._clearConfirmMessage)) {
this._previewBehavior.reset();Sys.Net.WebServiceProxy.invoke(this._servicePath, 'Reset', false, null, this._onCalendarLoadedDelegate, null, null);}
},
_onImageTextClickEvent: function(evt) {
evt.preventDefault();this._raiseEvent('imageTextClick', Sys.EventArgs.Empty);},
_onHelpClickEvent: function(evt) {
evt.preventDefault();},
_onAddToCartClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
this._enableDisableCommands(false);Sys.Net.WebServiceProxy.invoke(this._servicePath, 'Validate', false, null, this._onCalendarValidateDelegate, null, null);}
},
_onAddToCartCompleteEvent: function(sender, args) {
this._enableDisableCommands(true);alert(this._addToCartCompleteMessage);},
_onCalendarValidateEvent: function(sender, args) {
if (sender.IsValid) {
if (confirm(sender.Message)) {
var quantity = 1;quantity = parseInt(this._quantityInput.value);if (isNaN(quantity) || quantity <= 0) {
quantity = 1;}
var params = { quantity: quantity, cartName: this._cartNameInput.value };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'AddToCart', false, params, this._onAddToCartCompleteDelegate, null, null);} else {
this._enableDisableCommands(true);}
}
else if (!sender.IsValid) {
this._enableDisableCommands(true);alert(sender.Message);}
},
_initializeStartMonth: function() {
var current = null;var month = 0;if (this._startMonthSelect.options.length > 0) {
this._startMonthSelect.options.length = 0;}
var month = this._minMonth;for (var year = this._minYear;year <= this._maxYear;year++) {
while (month <= 12) {
if (year >= this._maxYear && month > this._maxMonth) {
break;}
current = document.createElement('option');this._startMonthSelect.appendChild(current);current.innerHTML = String.format("{0}, {1}", year, this._monthsArray[month - 1]);current.value = String.format("{0}:{1}", year, month);current.selected = false;if (year == this._currentCalendar.StartYear && month == this._currentCalendar.StartMonth) {
current.selected = true;}
this._startMonthSelect.appendChild(current);month++;}
month = 1;}
},
_initializeCalendar: function() {
var page = null;var behaviourElement = null;var dropBehavior = null;var currentLI = null;var currentP = null;var currentIMG = null;var create = (this._calendarImageBehaviours == null);if (create) {
this._calendarImageBehaviours = new Array();this._previewBehavior = $create(Inductronic.DropTargetImageBehavior, { id: this._previewImage.id, imageRecipe: this._imagePreviewRecipe, preloadImageUrl: this._preloadImageUrl }, { imageChanged: this._onImageChangedExternalDelegate }, null, this._previewImage);}
for (var i = 0;i < this._currentCalendar.Pages.length;i++) {
page = this._currentCalendar.Pages[i];if (create) {
currentLI = document.createElement('li');this._monthList.appendChild(currentLI);currentP = document.createElement('p');currentLI.appendChild(currentP);currentP.innerHTML = String.format('<strong>{0}<br />{1}</strong>', this._monthsArray[page.Month - 1], page.Year);behaviourElement = document.createElement('img');behaviourElement.id = this._generateId('month_' + i.toString());currentLI.appendChild(behaviourElement);dropBehavior = $create(Inductronic.DropTargetImageBehavior, { id: behaviourElement.id, index: page.Month, key: page.Image, imageRecipe: this._imageRecipe, preloadImageUrl: this._preloadImageUrl, data: String.format('{0}:{1}', page.Year, page.Month), description: page.ImageText }, { imageClick: this._onImageClickExternalDelegate, imageChanged: this._onImageChangedExternalDelegate }, null, behaviourElement);this._calendarImageBehaviours.push(dropBehavior);dropBehavior.update();} else {
dropBehavior = this._calendarImageBehaviours[i];behaviourElement = dropBehavior.get_element().parentNode.firstChild;behaviourElement.innerHTML = String.format('<strong>{0}<br />{1}</strong>', this._monthsArray[page.Month - 1], page.Year);dropBehavior.reset();dropBehavior.set_key(page.Image);dropBehavior.set_index(page.Month);dropBehavior.set_description(page.ImageText);dropBehavior.set_data(String.format('{0}:{1}', page.Year, page.Month));dropBehavior.update();}
}
},
_initializeFormat: function(format) {
if (this._formatSelect.options.length > 0) {
this._formatSelect.options.length = 0;}
var current = document.createElement('option');this._formatSelect.appendChild(current);current.value = 0;current.selected = (format == 0);current.innerHTML = this._formatA3Title;current = document.createElement('option');this._formatSelect.appendChild(current);current.value = 1;current.selected = (format == 1);current.innerHTML = this._formatA4Title;if (this._enableA5 == true) {
current = document.createElement('option');this._formatSelect.appendChild(current);current.value = 2;current.selected = (format == 2);current.innerHTML = this._formatA5Title;}
},
_initializeIllustration: function(format) {
if (format == 0) {
if (Sys.UI.DomElement.containsCssClass(this._previewDiv, 'cala4')) {
Sys.UI.DomElement.removeCssClass(this._previewDiv, 'cala4');}
if (!Sys.UI.DomElement.containsCssClass(this._previewDiv, 'cala3')) {
Sys.UI.DomElement.addCssClass(this._previewDiv, 'cala3');}
if (Sys.UI.DomElement.containsCssClass(this._previewImage, 'picturea4')) {
Sys.UI.DomElement.removeCssClass(this._previewImage, 'picturea4');}
if (!Sys.UI.DomElement.containsCssClass(this._previewImage, 'picturea3')) {
Sys.UI.DomElement.addCssClass(this._previewImage, 'picturea3');}
}
else if (format == 1 || format == 2) {
if (Sys.UI.DomElement.containsCssClass(this._previewDiv, 'cala3')) {
Sys.UI.DomElement.removeCssClass(this._previewDiv, 'cala3');}
if (!Sys.UI.DomElement.containsCssClass(this._previewDiv, 'cala4')) {
Sys.UI.DomElement.addCssClass(this._previewDiv, 'cala4');}
if (Sys.UI.DomElement.containsCssClass(this._previewImage, 'picturea3')) {
Sys.UI.DomElement.removeCssClass(this._previewImage, 'picturea3');}
if (!Sys.UI.DomElement.containsCssClass(this._previewImage, 'picturea4')) {
Sys.UI.DomElement.addCssClass(this._previewImage, 'picturea4');}
}
},
add_imageTextClick: function(handler) {
this.get_events().addHandler('imageTextClick', handler);},
remove_imageTextClick: function(handler) {
this.get_events().removeHandler('imageTextClick', handler);},
_raiseEvent: function(eventName, eventArgs) {
var handler = this.get_events().getHandler(eventName);if (handler) {
if (!eventArgs) {
eventArgs = Sys.EventArgs.Empty;}
handler(this, eventArgs);}
},
get_calendar: function() {
return this._currentCalendar;},
get_monthsArray: function() {
return this._monthsArray;},
get_imageRecipe: function() {
return this._imageRecipe;},
set_imageRecipe: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._imageRecipe != value) {
this._imageRecipe = value;this.raisePropertyChanged('imageRecipe');}
},
get_imagePreviewRecipe: function() {
return this._imagePreviewRecipe;},
set_imagePreviewRecipe: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._imagePreviewRecipe != value) {
this._imagePreviewRecipe = value;this.raisePropertyChanged('imagePreviewRecipe');}
},
get_previewImagesUrl: function() {
return this._previewImagesUrl;},
set_previewImagesUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._previewImagesUrl != value) {
this._previewImagesUrl = value;if (!this._previewImagesUrl.endsWith('/')) {
this._previewImagesUrl += '/';}
this.raisePropertyChanged('previewImagesUrl');}
},
get_loadingImageUrl: function() {
return this._loadingImageUrl;},
set_loadingImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._loadingImageUrl != value) {
this._loadingImageUrl = value;this.raisePropertyChanged('loadingImageUrl');}
},
get_preloadImageUrl: function() {
return this._preloadImageUrl;},
set_preloadImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._preloadImageUrl != value) {
this._preloadImageUrl = value;this.raisePropertyChanged('preloadImageUrl');}
},
get_servicePath: function() {
return this._servicePath;},
set_servicePath: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._servicePath != value) {
this._servicePath = value;this.raisePropertyChanged('servicePath');}
},
get_startMonth: function() {
return this._startMonth;},
set_startMonth: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: Number}]);if (e) throw e;if (this._startMonth != value) {
this._startMonth = value;this.raisePropertyChanged('startMonth');}
},
get_minMonth: function() {
return this._minMonth;},
set_minMonth: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: Number}]);if (e) throw e;if (this._minMonth != value) {
this._minMonth = value;this.raisePropertyChanged('minMonth');}
},
get_maxMonth: function() {
return this._maxMonth;},
set_maxMonth: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: Number}]);if (e) throw e;if (this._maxMonth != value) {
this._maxMonth = value;this.raisePropertyChanged('maxMonth');}
},
get_startYear: function() {
return this._startYear;},
set_startYear: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: Number}]);if (e) throw e;if (this._startYear != value) {
this._startYear = value;this.raisePropertyChanged('startYear');}
},
get_minYear: function() {
return this._minYear;},
set_minYear: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: Number}]);if (e) throw e;if (this._minYear != value) {
this._minYear = value;this.raisePropertyChanged('minYear');}
},
get_maxYear: function() {
return this._maxYear;},
set_maxYear: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: Number}]);if (e) throw e;if (this._maxYear != value) {
this._maxYear = value;this.raisePropertyChanged('maxYear');}
},
get_months: function() {
return this._months;},
set_months: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._months != value) {
this._months = value;this.raisePropertyChanged('months');}
},
get_clearConfirmMessage: function() {
return this._clearConfirmMessage;},
set_clearConfirmMessage: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._clearConfirmMessage != value) {
this._clearConfirmMessage = value;this.raisePropertyChanged('clearConfirmMessage');}
},
get_cartNameTitle: function() {
return this._cartNameTitle;},
set_cartNameTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._cartNameTitle != value) {
this._cartNameTitle = value;this.raisePropertyChanged('cartNameTitle');}
},
get_cartNameDefault: function() {
return this._cartNameDefault;},
set_cartNameDefault: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._cartNameDefault != value) {
this._cartNameDefault = value;this.raisePropertyChanged('cartNameDefault');}
},
get_formatTitle: function() {
return this._formatTitle;},
set_formatTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._formatTitle != value) {
this._formatTitle = value;this.raisePropertyChanged('formatTitle');}
},
get_startMonthTitle: function() {
return this._startMonthTitle;},
set_startMonthTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._startMonthTitle != value) {
this._startMonthTitle = value;this.raisePropertyChanged('startMonthTitle');}
},
get_clearTitle: function() {
return this._clearTitle;},
set_clearTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._clearTitle != value) {
this._clearTitle = value;this.raisePropertyChanged('clearTitle');}
},
get_imageTextTitle: function() {
return this._imageTextTitle;},
set_imageTextTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._imageTextTitle != value) {
this._imageTextTitle = value;this.raisePropertyChanged('imageTextTitle');}
},
get_cartInfoTitle: function() {
return this._cartInfoTitle;},
set_cartInfoTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._cartInfoTitle != value) {
this._cartInfoTitle = value;this.raisePropertyChanged('cartInfoTitle');}
},
get_minimumQuantity: function() {
return this._minimumQuantity;},
set_minimumQuantity: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._minimumQuantity != value) {
this._minimumQuantity = value;this.raisePropertyChanged('minimumQuantity');}
},
get_pricePrefix: function() {
return this._pricePrefix;},
set_pricePrefix: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._pricePrefix != value) {
this._pricePrefix = value;this.raisePropertyChanged('pricePrefix');}
},
get_price: function() {
return this._price;},
set_price: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._price != value) {
this._price = value;this.raisePropertyChanged('price');}
},
get_addToCartTitle: function() {
return this._addToCartTitle;},
set_addToCartTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._addToCartTitle != value) {
this._addToCartTitle = value;this.raisePropertyChanged('addToCartTitle');}
},
get_addToCartCompleteMessage: function() {
return this._addToCartCompleteMessage;},
set_addToCartCompleteMessage: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._addToCartCompleteMessage != value) {
this._addToCartCompleteMessage = value;this.raisePropertyChanged('addToCartCompleteMessage');}
},
get_helpTitle: function() {
return this._helpTitle;},
set_helpTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._helpTitle != value) {
this._helpTitle = value;this.raisePropertyChanged('helpTitle');}
},
get_formatA3Title: function() {
return this._formatA3Title;},
set_formatA3Title: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._formatA3Title != value) {
this._formatA3Title = value;this.raisePropertyChanged('formatA3Title');}
},
get_formatA4Title: function() {
return this._formatA4Title;},
set_formatA4Title: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._formatA4Title != value) {
this._formatA4Title = value;this.raisePropertyChanged('formatA4Title');}
},
get_formatA5Title: function() {
return this._formatA5Title;},
set_formatA5Title: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._formatA5Title != value) {
this._formatA5Title = value;this.raisePropertyChanged('formatA5Title');}
},
get_enableA5: function() {
return this._enableA5;},
set_enableA5: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: Boolean}]);if (e) throw e;if (this._enableA5 != value) {
this._enableA5 = value;this.raisePropertyChanged('enableA5');}
}
}
Inductronic.CalendarBehavior.registerClass('Inductronic.CalendarBehavior', Sys.UI.Control, Sys.IDisposable );
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();