﻿Type.registerNamespace('Inductronic');Inductronic.PhotoBookPageSide = function() {
}
Inductronic.PhotoBookPageSide.prototype = {
Left : 0,
Right : 1
}
Inductronic.PhotoBookPageSide.registerEnum('Inductronic.PhotoBookPageSide', false);Inductronic.PhotoBookPageType = function() {
}
Inductronic.PhotoBookPageType.prototype = {
Image : 0,
Front : 1,
Back : 2,
Text : 3,
Blank : 4,
Hidden : 5
}
Inductronic.PhotoBookPageType.registerEnum('Inductronic.PhotoBookPageType', false);Inductronic.PhotoBookFormat = function() {
}
Inductronic.PhotoBookFormat.prototype = {
A4 : 0,
A5 : 1,
A6 : 2
}
Inductronic.PhotoBookFormat.registerEnum('Inductronic.PhotoBookFormat', false);Inductronic.PhotoBookCoverColor = function() {
}
Inductronic.PhotoBookCoverColor.prototype = {
Black : 0,
White : 1
}
Inductronic.PhotoBookCoverColor.registerEnum('Inductronic.PhotoBookCoverColor', false);Inductronic.PhotoBookImageAlign = function() {
}
Inductronic.PhotoBookImageAlign.prototype = { 
BestFit : 0, 
Fill : 1
}
Inductronic.PhotoBookImageAlign.registerEnum('Inductronic.PhotoBookImageAlign', false);Inductronic.PhotoBookTemplate = function() {
}
Inductronic.PhotoBookTemplate.prototype = {
Hardcover : 0,
Spiral : 1
}
Inductronic.PhotoBookTemplate.registerEnum('Inductronic.PhotoBookTemplate', false);Inductronic.PhotoBookBehavior = function(element) {
Inductronic.PhotoBookBehavior.initializeBase(this, [element]);this._loaded = false;this._eventsAttached = false;this._isEnabled = false;this._currentPhotoBook = null;this._displayPerPage = 8;this._miniaturePageCount = -1;this._currentMiniaturePage = -1;this._currentPage = 0;this._bypassSlider = false;this._handleImageUrl = null;this._previousImageUrl = '';this._nextImageUrl = '';this._imageRecipeBestFit = '';this._imagePreviewRecipeBestFit = '';this._imageRecipeFill = '';this._imagePreviewRecipeFill = '';this._loadingImageUrl = '';this._preloadImageUrl = '';this._servicePath = '';this._clearConfirmMessage = '';this._cartNameTitle = '';this._cartNameDefault = '';this._formatTitle = '';this._clearTitle = '';this._settingsTitle = '';this._cartInfoTitle = '';this._minimumQuantity = '';this._pricePrefix = '';this._addToCartTitle = '';this._addToCartCompleteMessage = '';this._helpTitle = '';this._deleteImageUrl = '';this._alignImageUrl = '';this._pageCoverTitle = '';this._pageBackTitle = '';this._pageTitleFormat = '{0}';this._pagePairTitleFormat = '{0} - {1}';this._pageTextTitle = '';this._pageEmptyTitle = '';this._onImageManagerRotateDelegate = null;this._onImageManagerDeleteDelegate = null;this._onImageManagerLoadedDelegate = null;this._onSliderSlideDelegate = null;this._onSliderStartDelegate = null;this._onSliderEndDelegate = null;this._onPreviousClickDelegate = null;this._onNextClickDelegate = null;this._onPreviousPreviewClickDelegate = null;this._onNextPreviewClickDelegate = null;this._onFormatChangedDelegate = null;this._onPhotoBookLoadedDelegate = null;this._onImageClickPreviewDelegate = null;this._onImageChangedPreviewDelegate = null;this._onImageClickPagesDelegate = null;this._onImageChangedPagesDelegate = null;this._onClearClickDelegate = null;this._onSettingsClickDelegate = null;this._onHelpClickDelegate = null;this._onAddToCartClickDelegate = null;this._onAddToCartCompleteDelegate = null;this._onPhotoBookValidateDelegate = null;this._onLeftAlignDelegate = null;this._onLeftDeleteDelegate = null;this._onRightAlignDelegate = null;this._onRightDeleteDelegate = null;this._scrollbarBehavior = null;this._pageBehaviors = new Array();this._currentPageBehavior = null;this._dualPagePreviewBehavior = null;this._singlePagePreviewBehavior = null;this._leftAlignAnchor = null;this._leftDeleteAnchor = null;this._rightAlignAnchor = null;this._rightDeleteAnchor = null;this._pagesList = null;this._previousLink = null;this._nextLink = null;this._previousPreviewLink = null;this._nextPreviewLink = null;this._helpAnchor = null;this._settingsAnchor = null;this._clearAnchor = null;this._pagesDiv = null;this._previewPage = null;this._previewContainer = null;this._addToCartAnchor = null;this._pageInfoSpan = null;this._priceP = null;}
Inductronic.PhotoBookBehavior.prototype = {
initialize: function() {
Inductronic.PhotoBookBehavior.callBaseMethod(this, 'initialize');this._handleDelegates(true);var el = this.get_element();var current = null;this._pagesDiv = document.createElement('div');el.appendChild(this._pagesDiv);Sys.UI.DomElement.addCssClass(this._pagesDiv, 'pages');this._createPages();var scrollbarElement = document.createElement('div');scrollbarElement.id = this._generateId('scrollbar');this._pagesDiv.appendChild(scrollbarElement);Sys.UI.DomElement.addCssClass(scrollbarElement, 'scrollbar');var previousDiv = document.createElement('div');scrollbarElement.appendChild(previousDiv);Sys.UI.DomElement.addCssClass(previousDiv, 'arrow first');this._previousLink = document.createElement('a');previousDiv.appendChild(this._previousLink);var previousImage = document.createElement('img');this._previousLink.appendChild(previousImage);previousImage.src = this._previousImageUrl;previousImage.alt = '';this._scrollbarBehavior = $create(Inductronic.SliderBehavior, { id: scrollbarElement.id, tooltipText: '{0}', enableHandleAnimation: true, railCssClass: 'rail', handleCssClass: 'handle', handleImageUrl: this._handleImageUrl }, { valueChanged: this._onSliderSlideDelegate, slideStart: this._onSliderStartDelegate, slideEnd: this._onSliderEndDelegate }, null, scrollbarElement);var nextDiv = document.createElement('div');scrollbarElement.appendChild(nextDiv);Sys.UI.DomElement.addCssClass(nextDiv, 'arrow last');this._nextLink = document.createElement('a');nextDiv.appendChild(this._nextLink);var nextImage = document.createElement('img');this._nextLink.appendChild(nextImage);nextImage.src = this._nextImageUrl;nextImage.alt = '';var clearDiv = document.createElement('div');scrollbarElement.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');this._previewPage = document.createElement('div');el.appendChild(this._previewPage);Sys.UI.DomElement.addCssClass(this._previewPage, 'page');this._previewContainer = document.createElement('div');this._previewPage.appendChild(this._previewContainer);Sys.UI.DomElement.addCssClass(this._previewContainer, 'container');var previousDiv = document.createElement('div');this._previewContainer.appendChild(previousDiv);Sys.UI.DomElement.addCssClass(previousDiv, 'arrow first');this._previousPreviewLink = document.createElement('a');previousDiv.appendChild(this._previousPreviewLink);previousImage = document.createElement('img');this._previousPreviewLink.appendChild(previousImage);previousImage.src = this._previousImageUrl;previousImage.alt = '';this._createSinglePagePreview();this._createDualPagePreview();nextDiv = document.createElement('div');this._previewContainer.appendChild(nextDiv);Sys.UI.DomElement.addCssClass(nextDiv, 'arrow last');this._nextPreviewLink = document.createElement('a');nextDiv.appendChild(this._nextPreviewLink);nextImage = document.createElement('img');this._nextPreviewLink.appendChild(nextImage);nextImage.src = this._nextImageUrl;nextImage.alt = '';clearDiv = document.createElement('div');this._previewContainer.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');this._helpAnchor = document.createElement('a');this._previewPage.appendChild(this._helpAnchor);this._helpAnchor.href = '';this._helpAnchor.innerHTML = this._helpTitle;Sys.UI.DomElement.addCssClass(this._helpAnchor, 'help');var settings = document.createElement('div');el.appendChild(settings);Sys.UI.DomElement.addCssClass(settings, 'settings');var book = document.createElement('div');settings.appendChild(book);Sys.UI.DomElement.addCssClass(book, 'book');current = document.createElement('div');book.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');book.appendChild(current);Sys.UI.DomElement.addCssClass(current, 'button');this._settingsAnchor = document.createElement('a');current.appendChild(this._settingsAnchor);this._settingsAnchor.href = '';this._settingsAnchor.innerHTML = this._settingsTitle;clearDiv = document.createElement('div');book.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');var pageInfo = document.createElement('div');settings.appendChild(pageInfo);Sys.UI.DomElement.addCssClass(pageInfo, 'pageinfo');current = document.createElement('div');pageInfo.appendChild(current);Sys.UI.DomElement.addCssClass(current, 'div');this._leftAlignAnchor = document.createElement('a');current.appendChild(this._leftAlignAnchor);this._leftAlignAnchor.href = '';var image = document.createElement('img');this._leftAlignAnchor.appendChild(image);image.src = this._alignImageUrl;image.alt = '';this._leftDeleteAnchor = document.createElement('a');current.appendChild(this._leftDeleteAnchor);this._leftDeleteAnchor.href = '';var image = document.createElement('img');this._leftDeleteAnchor.appendChild(image);image.src = this._deleteImageUrl;image.alt = '';this._pageInfoSpan = document.createElement('span');pageInfo.appendChild(this._pageInfoSpan);this._pageInfoSpan.innerHTML = '';current = document.createElement('div');pageInfo.appendChild(current);Sys.UI.DomElement.addCssClass(current, 'div');this._rightAlignAnchor = document.createElement('a');current.appendChild(this._rightAlignAnchor);this._rightAlignAnchor.href = '';var image = document.createElement('img');this._rightAlignAnchor.appendChild(image);image.src = this._alignImageUrl;image.alt = '';this._rightDeleteAnchor = document.createElement('a');current.appendChild(this._rightDeleteAnchor);this._rightDeleteAnchor.href = '';var image = document.createElement('img');this._rightDeleteAnchor.appendChild(image);image.src = this._deleteImageUrl;image.alt = '';clearDiv = document.createElement('div');pageInfo.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');var addcart = document.createElement('div');settings.appendChild(addcart);Sys.UI.DomElement.addCssClass(addcart, 'addcart');current = document.createElement('div');addcart.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');addcart.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');current = document.createElement('div');settings.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;this._priceP = document.createElement('p');current.appendChild(this._priceP);clearDiv = document.createElement('div');settings.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');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());if (this._pageBehaviors) {
delete this._pageBehaviors;this._pageBehaviors = null;}
var applicationManager = this.get_applicationManager();if (applicationManager) {
applicationManager.remove_loaded(this._onImageManagerLoadedDelegate);applicationManager.remove_rotate(this._onImageManagerRotateDelegate);applicationManager.remove_delete(this._onImageManagerDeleteDelegate);}
if (this._scrollbarBehavior) {
this._scrollbarBehavior.remove_valueChanged(this._onSliderSlideDelegate);this._scrollbarBehavior.remove_slideStart(this._onSliderStartDelegate);this._scrollbarBehavior.remove_slideEnd(this._onSliderEndDelegate);this._scrollbarBehavior = null;}
this._handleEvents(false);this._handleDelegates(false);Inductronic.PhotoBookBehavior.callBaseMethod(this, 'dispose');},
_handleEvents: function(attach) {
if (attach === true && this._eventsAttached === false) {
this._eventsAttached = true;$addHandler(this._nextLink, 'click', this._onNextClickDelegate);$addHandler(this._previousLink, 'click', this._onPreviousClickDelegate);$addHandler(this._helpAnchor, 'click', this._onHelpClickDelegate);$addHandler(this._previousPreviewLink, 'click', this._onPreviousPreviewClickDelegate);$addHandler(this._nextPreviewLink, 'click', this._onNextPreviewClickDelegate);$addHandler(this._settingsAnchor, 'click', this._onSettingsClickDelegate);$addHandler(this._clearAnchor, 'click', this._onClearClickDelegate);$addHandler(this._addToCartAnchor, 'click', this._onAddToCartClickDelegate);$addHandler(this._leftAlignAnchor, 'click', this._onLeftAlignDelegate);$addHandler(this._leftDeleteAnchor, 'click', this._onLeftDeleteDelegate);$addHandler(this._rightAlignAnchor, 'click', this._onRightAlignDelegate);$addHandler(this._rightDeleteAnchor, 'click', this._onRightDeleteDelegate);}
else if (this._eventsAttached === true) {
$removeHandler(this._nextLink, 'click', this._onNextClickDelegate);$removeHandler(this._previousLink, 'click', this._onPreviousClickDelegate);$removeHandler(this._helpAnchor, 'click', this._onHelpClickDelegate);$removeHandler(this._previousPreviewLink, 'click', this._onPreviousPreviewClickDelegate);$removeHandler(this._nextPreviewLink, 'click', this._onNextPreviewClickDelegate);$removeHandler(this._settingsAnchor, 'click', this._onSettingsClickDelegate);$removeHandler(this._clearAnchor, 'click', this._onClearClickDelegate);$removeHandler(this._addToCartAnchor, 'click', this._onAddToCartClickDelegate);$removeHandler(this._leftAlignAnchor, 'click', this._onLeftAlignDelegate);$removeHandler(this._leftDeleteAnchor, 'click', this._onLeftDeleteDelegate);$removeHandler(this._rightAlignAnchor, 'click', this._onRightAlignDelegate);$removeHandler(this._rightDeleteAnchor, 'click', this._onRightDeleteDelegate);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._onSliderStartDelegate === null) {
this._onSliderStartDelegate = Function.createDelegate(this, this._onSliderStartEvent);}
if (this._onSliderEndDelegate === null) {
this._onSliderEndDelegate = Function.createDelegate(this, this._onSliderEndEvent);}
if (this._onSliderSlideDelegate === null) {
this._onSliderSlideDelegate = Function.createDelegate(this, this._onSliderSlideEvent);}
if (this._onPreviousClickDelegate === null) {
this._onPreviousClickDelegate = Function.createDelegate(this, this._onPreviousClickEvent);}
if (this._onNextClickDelegate === null) {
this._onNextClickDelegate = Function.createDelegate(this, this._onNextClickEvent);}
if (this._onPreviousPreviewClickDelegate === null) {
this._onPreviousPreviewClickDelegate = Function.createDelegate(this, this._onPreviousPreviewClickEvent);}
if (this._onNextPreviewClickDelegate === null) {
this._onNextPreviewClickDelegate = Function.createDelegate(this, this._onNextPreviewClickEvent);}
if (this._onLeftAlignDelegate === null) {
this._onLeftAlignDelegate = Function.createDelegate(this, this._onLeftAlignEvent);}
if (this._onLeftDeleteDelegate === null) {
this._onLeftDeleteDelegate = Function.createDelegate(this, this._onLeftDeleteEvent);}
if (this._onRightAlignDelegate === null) {
this._onRightAlignDelegate = Function.createDelegate(this, this._onRightAlignEvent);}
if (this._onRightDeleteDelegate === null) {
this._onRightDeleteDelegate = Function.createDelegate(this, this._onRightDeleteEvent);}
if (this._onFormatChangedDelegate === null) {
this._onFormatChangedDelegate = Function.createDelegate(this, this._onFormatChangedEvent);}
if (this._onPhotoBookLoadedDelegate === null) {
this._onPhotoBookLoadedDelegate = Function.createDelegate(this, this._onPhotoBookLoadedEvent);}
if (this._onImageClickPreviewDelegate === null) {
this._onImageClickPreviewDelegate = Function.createDelegate(this, this._onImageClickPreviewEvent);}
if (this._onImageChangedPreviewDelegate === null) {
this._onImageChangedPreviewDelegate = Function.createDelegate(this, this._onImageChangedPreviewEvent);}
if (this._onImageClickPagesDelegate === null) {
this._onImageClickPagesDelegate = Function.createDelegate(this, this._onImageClickPagesEvent);}
if (this._onImageChangedPagesDelegate === null) {
this._onImageChangedPagesDelegate = Function.createDelegate(this, this._onImageChangedPagesEvent);}
if (this._onClearClickDelegate === null) {
this._onClearClickDelegate = Function.createDelegate(this, this._onClearClickEvent);}
if (this._onSettingsClickDelegate === null) {
this._onSettingsClickDelegate = Function.createDelegate(this, this._onSettingsClickEvent);}
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._onPhotoBookValidateDelegate === null) {
this._onPhotoBookValidateDelegate = Function.createDelegate(this, this._onPhotoBookValidateEvent);}
}
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._onSliderSlideDelegate) {
delete this._onSliderSlideDelegate;this._onSliderSlideDelegate = null;}
if (this._onSliderStartDelegate) {
delete this._onSliderStartDelegate;this._onSliderStartDelegate = null;}
if (this._onSliderEndDelegate) {
delete this._onSliderEndDelegate;this._onSliderEndDelegate = null;}
if (this._onPreviousClickDelegate) {
delete this._onPreviousClickDelegate;this._onPreviousClickDelegate = null;}
if (this._onNextClickDelegate) {
delete this._onNextClickDelegate;this._onNextClickDelegate = null;}
if (this._onPreviousPreviewClickDelegate) {
delete this._onPreviousPreviewClickDelegate;this._onPreviousPreviewClickDelegate = null;}
if (this._onNextPreviewClickDelegate) {
delete this._onNextPreviewClickDelegate;this._onNextPreviewClickDelegate = null;}
if (this._onLeftAlignDelegate) {
delete this._onLeftAlignDelegate;this._onLeftAlignDelegate = null;}
if (this._onLeftDeleteDelegate) {
delete this._onLeftDeleteDelegate;this._onLeftDeleteDelegate = null;}
if (this._onRightAlignDelegate) {
delete this._onRightAlignDelegate;this._onRightAlignDelegate = null;}
if (this._onRightDeleteDelegate) {
delete this._onRightDeleteDelegate;this._onRightDeleteDelegate = null;}
if (this._onFormatChangedDelegate) {
delete this._onFormatChangedDelegate;this._onFormatChangedDelegate = null;}
if (this._onPhotoBookLoadedDelegate) {
delete this._onPhotoBookLoadedDelegate;this._onPhotoBookLoadedDelegate = null;}
if (this._onImageClickPreviewDelegate) {
delete this._onImageClickPreviewDelegate;this._onImageClickPreviewDelegate = null;}
if (this._onImageChangedPreviewDelegate) {
delete this._onImageChangedPreviewDelegate;this._onImageChangedPreviewDelegate = null;}
if (this._onImageClickPagesDelegate) {
delete this._onImageClickPagesDelegate;this._onImageClickPagesDelegate = null;}
if (this._onImageChangedPagesDelegate) {
delete this._onImageChangedPagesDelegate;this._onImageChangedPagesDelegate = null;}
if (this._onClearClickDelegate) {
delete this._onClearClickDelegate;this._onClearClickDelegate = null;}
if (this._onSettingsClickDelegate) {
delete this._onSettingsClickDelegate;this._onSettingsClickDelegate = 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._onPhotoBookValidateDelegate) {
delete this._onPhotoBookValidateDelegate;this._onPhotoBookValidateDelegate = null;}
}
},
_generateId: function(id) {
return this.get_id() + '_' + id;},
_isCommandsEnabled: function() {
return this._isEnabled;},
_enableDisableCommands: function(enable) {
this._isEnabled = enable;},
get_applicationManager: function() {
return Inductronic.ApplicationManagerBehavior.getInstance();},
_createPages: function() {
if (this._pagesList == null) {
this._pagesList = document.createElement('ul');this._pagesDiv.appendChild(this._pagesList);var parent = null;for (var i = 0;i < this._displayPerPage;i++) {
parent = document.createElement('li');this._pagesList.appendChild(parent);parent.id = this._generateId(String.format('p_{0}', i));$common.setVisible(parent, false);this._pageBehaviors.push($create(Inductronic.PageBehavior, { id: parent.id, index: i, imageRecipeBestFit: this._imageRecipeBestFit, imageRecipeFill: this._imageRecipeFill, preloadImageUrl: this._preloadImageUrl }, { imageClick: this._onImageClickPagesDelegate, imageChanged: this._onImageChangedPagesDelegate }, null, parent));}
}
},
_createSinglePagePreview: function() {
var parent = document.createElement('div');this._previewContainer.appendChild(parent);parent.id = this._generateId('sp');this._singlePagePreviewBehavior = $create(Inductronic.SinglePagePreviewBehavior, { id: parent.id, imageRecipeBestFit: this._imagePreviewRecipeBestFit, imageRecipeFill: this._imagePreviewRecipeFill, preloadImageUrl: this._preloadImageUrl }, { imageClick: this._onImageClickPreviewDelegate, imageChanged: this._onImageChangedPreviewDelegate }, null, parent);},
_createDualPagePreview: function() {
var parent = document.createElement('div');this._previewContainer.appendChild(parent);parent.id = this._generateId('dp');this._dualPagePreviewBehavior = $create(Inductronic.DualPagePreviewBehavior, { id: parent.id, imageRecipeBestFit: this._imagePreviewRecipeBestFit, imageRecipeFill: this._imagePreviewRecipeFill, preloadImageUrl: this._preloadImageUrl }, { imageClick: this._onImageClickPreviewDelegate, imageChanged: this._onImageChangedPreviewDelegate }, null, parent);},
_formatPreviewPageText: function(page1, page2) {
var offset = this._currentPhotoBook.Offset;if (page1 != null && page2 == null) {
this._pageInfoSpan.innerHTML = this._formatPageCaption(page1);} else if (page1 != null && page2 != null) {
this._pageInfoSpan.innerHTML = this._formatPagePairNameFromIndex(page1.PageType, page1.Index, page2.Index, offset);}
},
_formatPagePairNameFromIndex: function(pageType, index1, index2, offset) {
var result = '';switch (pageType) {
case Inductronic.PhotoBookPageType.Image:
result = String.format(this._pagePairTitleFormat, index1 - offset, index2 - offset);break;case Inductronic.PhotoBookPageType.Front:
result = this._pageCoverTitle;break;case Inductronic.PhotoBookPageType.Back:
result = this._pageBackTitle;break;case Inductronic.PhotoBookPageType.Text:
result = this._pageTextTitle;break;case Inductronic.PhotoBookPageType.Blank:
result = this._pageEmptyTitle;break;case Inductronic.PhotoBookPageType.Hidden:
result = this._pageEmptyTitle;break;}
return result;},
_formatPagePairNameFromIndex: function(pageType, index1, index2, offset) {
var i = 0;if (index1 > index2) {
i = index2;index2 = index1;index1 = i;}
var result = '';switch (pageType) {
case Inductronic.PhotoBookPageType.Image:
result = String.format(this._pagePairTitleFormat, index1 - offset, index2 - offset);break;case Inductronic.PhotoBookPageType.Front:
result = this._pageCoverTitle;break;case Inductronic.PhotoBookPageType.Back:
result = this._pageBackTitle;break;case Inductronic.PhotoBookPageType.Text:
result = this._pageTextTitle;break;case Inductronic.PhotoBookPageType.Blank:
result = this._pageEmptyTitle;break;case Inductronic.PhotoBookPageType.Hidden:
result = this._pageEmptyTitle;break;}
return result;},
_formatPageCaption: function(page) {
return this._formatPageNameFromIndex(page.PageType, page.Index, this._currentPhotoBook.Offset);},
_formatPageNameFromIndex: function(pageType, index, offset) {
var result = '';switch (pageType) {
case Inductronic.PhotoBookPageType.Image:
result = String.format(this._pageTitleFormat, index - offset);break;case Inductronic.PhotoBookPageType.Front:
result = this._pageCoverTitle;break;case Inductronic.PhotoBookPageType.Back:
result = this._pageBackTitle;break;case Inductronic.PhotoBookPageType.Text:
result = this._pageTextTitle;break;case Inductronic.PhotoBookPageType.Blank:
result = this._pageEmptyTitle;break;case Inductronic.PhotoBookPageType.Hidden:
result = this._pageEmptyTitle;break;}
return result;},
_initializeTemplate: function() {
if (this._currentPhotoBook.Template == Inductronic.PhotoBookTemplate.Hardcover) {
if (Sys.UI.DomElement.containsCssClass(this._pagesDiv, 'spiral')) {
Sys.UI.DomElement.removeCssClass(this._pagesDiv, 'spiral');}
if (Sys.UI.DomElement.containsCssClass(this._previewPage, 'spiral')) {
Sys.UI.DomElement.removeCssClass(this._previewPage, 'spiral');}
} else if (this._currentPhotoBook.Template == Inductronic.PhotoBookTemplate.Spiral) {
if (!Sys.UI.DomElement.containsCssClass(this._pagesDiv, 'spiral')) {
Sys.UI.DomElement.addCssClass(this._pagesDiv, 'spiral');}
if (!Sys.UI.DomElement.containsCssClass(this._previewPage, 'spiral')) {
Sys.UI.DomElement.addCssClass(this._previewPage, 'spiral');}
}
if (this._currentPhotoBook.CoverColor == Inductronic.PhotoBookCoverColor.Black) {
if (Sys.UI.DomElement.containsCssClass(this._pagesDiv, 'whitecover')) {
Sys.UI.DomElement.removeCssClass(this._pagesDiv, 'whitecover');}
if (Sys.UI.DomElement.containsCssClass(this._previewPage, 'whitecover')) {
Sys.UI.DomElement.removeCssClass(this._previewPage, 'whitecover');}
if (!Sys.UI.DomElement.containsCssClass(this._pagesDiv, 'blackcover')) {
Sys.UI.DomElement.addCssClass(this._pagesDiv, 'blackcover');}
if (!Sys.UI.DomElement.containsCssClass(this._previewPage, 'blackcover')) {
Sys.UI.DomElement.addCssClass(this._previewPage, 'blackcover');}
} else if (this._currentPhotoBook.CoverColor == Inductronic.PhotoBookTemplate.White) {
if (Sys.UI.DomElement.containsCssClass(this._pagesDiv, 'blackcover')) {
Sys.UI.DomElement.removeCssClass(this._pagesDiv, 'blackcover');}
if (Sys.UI.DomElement.containsCssClass(this._previewPage, 'blackcover')) {
Sys.UI.DomElement.removeCssClass(this._previewPage, 'blackcover');}
if (!Sys.UI.DomElement.containsCssClass(this._pagesDiv, 'whitecover')) {
Sys.UI.DomElement.addCssClass(this._pagesDiv, 'whitecover');}
if (!Sys.UI.DomElement.containsCssClass(this._previewPage, 'whitecover')) {
Sys.UI.DomElement.addCssClass(this._previewPage, 'whitecover');}
}
},
_initializeSlider: function() {
var length = this._miniaturePageCount;this._scrollbarBehavior.set_minimum(1);this._scrollbarBehavior.set_maximum(length);this._scrollbarBehavior.set_steps(length);this._setSliderValue(this._currentMiniaturePage, true);},
_initializePreview: function(pageBehavior) {
var behavior = null;var page = this._findPageFromPageBehavior(pageBehavior);if (page.PageType == Inductronic.PhotoBookPageType.Front) {
this._dualPagePreviewBehavior.hide();if (page.Images.length > 0) {
this._singlePagePreviewBehavior.set_enabled(true);this._singlePagePreviewBehavior.set_title(this._currentPhotoBook.Title);this._singlePagePreviewBehavior.set_align(page.Images[0].Align);this._singlePagePreviewBehavior.set_index(pageBehavior.get_index());this._singlePagePreviewBehavior.set_key(pageBehavior.get_key());this._singlePagePreviewBehavior.select();this._singlePagePreviewBehavior.show();this._singlePagePreviewBehavior.update(false);this._formatPreviewPageText(page, null);} else {
this._singlePagePreviewBehavior.set_enabled(false);this._singlePagePreviewBehavior.reset();this._singlePagePreviewBehavior.show();}
} else if (page.PageType == Inductronic.PhotoBookPageType.Image) {
this._singlePagePreviewBehavior.deselect();this._singlePagePreviewBehavior.hide();this._dualPagePreviewBehavior.set_enabled(true);this._dualPagePreviewBehavior.show();this._initializePreviewPage(pageBehavior, true);var page1 = page;pageBehavior = this._findNextOrPreviousPageBehavior(pageBehavior);page = this._findPageFromPageBehavior(pageBehavior);this._initializePreviewPage(pageBehavior, false);this._formatPreviewPageText(page1, page);} else {
this._singlePagePreviewBehavior.set_enabled(false);this._dualPagePreviewBehavior.set_enabled(false);}
},
_initializePreviewPage: function(pageBehavior, select) {
var key = '';var page = this._findPageFromPageBehavior(pageBehavior);if (select) {
this._dualPagePreviewBehavior.select(page.PageSide);}
if (page.PageSide == Inductronic.PhotoBookPageSide.Left) {
if (page.Images.length > 0) {
key = page.Images[0].Image;this._dualPagePreviewBehavior.set_index1(pageBehavior.get_index());this._dualPagePreviewBehavior.set_align1(page.Images[0].Align);this._dualPagePreviewBehavior.set_key1(key != null ? key : '');this._dualPagePreviewBehavior.update(Inductronic.PhotoBookPageSide.Left, false);} else {
this._dualPagePreviewBehavior.reset(Inductronic.PhotoBookPageSide.Left);}
} else if (page.PageSide == Inductronic.PhotoBookPageSide.Right) {
if (page.Images.length > 0) {
key = page.Images[0].Image;this._dualPagePreviewBehavior.set_index2(pageBehavior.get_index());this._dualPagePreviewBehavior.set_align2(page.Images[0].Align);this._dualPagePreviewBehavior.set_key2(key != null ? key : '');this._dualPagePreviewBehavior.update(Inductronic.PhotoBookPageSide.Right, false);} else {
this._dualPagePreviewBehavior.reset(Inductronic.PhotoBookPageSide.Right);}
}
},
_findNextOrPreviousPageIndex: function(currentIndex, previous) {
var length = 0;var page = null;if (previous) {
currentIndex--;} else {
currentIndex++;}
if (currentIndex < 0) {
currentIndex = 0;}
length = this._currentPhotoBook.Pages.length;if (currentIndex > (length - 1)) {
currentIndex = length - 1;}
do {
page = this._currentPhotoBook.Pages[currentIndex];if (page.PageType == Inductronic.PhotoBookPageType.Image || page.PageType == Inductronic.PhotoBookPageType.Front) {
break;}
if (previous) {
currentIndex--;} else {
currentIndex++;}
if (currentIndex < 0) {
currentIndex = -1;break;}
if (currentIndex > (length - 1)) {
currentIndex = -1;break;}
} while (true);return currentIndex;},
_findIntroTextPage: function() {
var result = null;var current = null;var length = this._currentPhotoBook.Pages.length;for (var i = 0;i < length;i++) {
current = this._currentPhotoBook.Pages[i];if (current.PageType == Inductronic.PhotoBookPageType.Text) {
result = current;break;}
}
return result;},
_findPageFromPageBehavior: function(pageBehavior) {
return this._currentPhotoBook.Pages[pageBehavior.get_index()];},
_findNextOrPreviousPageBehavior: function(pageBehavior) {
var result = null;var behavior = null;var length = this._pageBehaviors.length;var page = this._findPageFromPageBehavior(pageBehavior);var index = (page.PageSide == Inductronic.PhotoBookPageSide.Left) ? (pageBehavior.get_index() + 1) : (pageBehavior.get_index() - 1);for (var i = 0;i < length;i++) {
behavior = this._pageBehaviors[i];if (index == behavior.get_index()) {
result = behavior;break;}
}
return result;},
_createPageBySelectedIndex: function(selectedIndex) {
if (selectedIndex <= 0) {
selectedIndex = 1;} else {
selectedIndex++;}
var selectedPage = Math.ceil(selectedIndex / this._displayPerPage);this._createPageByPageIndex(selectedPage, false);},
_createPageByPageIndex: function(selectedPage, changeSelectedPage) {
var count = this._currentPhotoBook.Pages.length;var pages = Math.floor(count / this._displayPerPage);var leftOver = count % this._displayPerPage;if (leftOver > 0) {
pages += 1;}
if (selectedPage < 1) {
selectedPage = 1;}
else if (selectedPage > pages) {
selectedPage = pages;}
this._miniaturePageCount = pages;this._setSliderValue(selectedPage, true);if (this._currentMiniaturePage != selectedPage) {
this._currentMiniaturePage = selectedPage;var pageData = this._paging(selectedPage, count, this._displayPerPage);var i = 0;var image = null;var key = '';var behavior = null;var page = null;var index = 0;if (changeSelectedPage) {
this._currentPage = pageData.startOfPage;}
for (i = pageData.startOfPage;i < (pageData.startOfPage + (pageData.endOfPage - pageData.startOfPage + 1));i++) {
key = '';image = null;index = i - pageData.startOfPage;page = this._currentPhotoBook.Pages[i];behavior = this._pageBehaviors[index];behavior.set_index(page.Index);behavior.set_caption(this._formatPageCaption(page));behavior.set_enabled(page.PageType == Inductronic.PhotoBookPageType.Image || page.PageType == Inductronic.PhotoBookPageType.Front);if (page.Images != null && page.Images.length > 0) {
image = page.Images[0];key = image.Image;behavior.set_align(image.Align);behavior.set_key((key != null) ? key : '');} else {
behavior.set_enabled(false);behavior.reset();}
behavior.show();if (key != null && key.length > 0) {
behavior.update(false);} else {
behavior.reset();}
if (this._currentPage == page.Index) {
this._currentPageBehavior = behavior;behavior.select();}
else {
behavior.deselect();}
}
index++;for (var j = index;j < this._pageBehaviors.length;j++) {
behavior = this._pageBehaviors[j];behavior.reset();behavior.hide();}
}
else {
var behavior = null;for (var j = 0;j < this._displayPerPage;j++) {
behavior = this._pageBehaviors[j];if (this._currentPage == behavior.get_index()) {
this._currentPageBehavior = behavior;behavior.select();}
else {
behavior.deselect();}
}
}
},
_paging: function(whichPage, numItems, pageSize) {
var pages = Math.floor(numItems / pageSize);var wholePages = pages;var leftOver = numItems % pageSize;if (leftOver > 0) {
pages += 1;}
var currentPage = whichPage;if (currentPage > pages || currentPage < 0) {
return this._paging(1, numItems, pageSize);}
else {
return { startOfPage: pageSize * (currentPage - 1), endOfPage: Math.min((pageSize * (currentPage - 1)) + (pageSize - 1), ((wholePages * pageSize) + leftOver - 1)) };}
},
applyImage: function(key) {
if (this._currentPageBehavior != null) {
var image = null;var page = this._findPageFromPageBehavior(this._currentPageBehavior);if (key != null && key.length > 0 && page.Images != null && page.Images.length > 0) {
if (page.Images[0].Image != key) {
image = page.Images[0];image.Image = key;this._setPage(page);this._currentPageBehavior.set_key(key);this._currentPageBehavior.update(false);}
}
this._initializePreview(this._currentPageBehavior);}
},
_deleteImage: function(origin) {
var behavior = this._currentPageBehavior;if (behavior != null) {
var page = this._findPageFromPageBehavior(behavior);if (page != null) {
if (page.PageType == Inductronic.PhotoBookPageType.Front || page.PageType == Inductronic.PhotoBookPageType.Image) {
if (page.PageSide != origin) {
behavior = this._findNextOrPreviousPageBehavior(this._currentPageBehavior);page = this._findPageFromPageBehavior(behavior);}
if (page.Images.length > 0) {
var image = page.Images[0];if (image.Image != null && image.Image.length > 0) {
image.Image = '';image.Align = Inductronic.PhotoBookImageAlign.BestFit;this._resetByIndex(page.Index, 0);behavior.set_key('');behavior.set_align(Inductronic.PhotoBookImageAlign.BestFit);behavior.update(false);if (page.PageType == Inductronic.PhotoBookPageType.Front) {
this._singlePagePreviewBehavior.set_key('');this._singlePagePreviewBehavior.set_align(Inductronic.PhotoBookImageAlign.BestFit);this._singlePagePreviewBehavior.update(false);} else if (page.PageType == Inductronic.PhotoBookPageType.Image) {
if (page.PageSide == Inductronic.PhotoBookPageSide.Left) {
this._dualPagePreviewBehavior.set_key1('');this._dualPagePreviewBehavior.set_align1(Inductronic.PhotoBookImageAlign.BestFit);this._dualPagePreviewBehavior.update(page.PageSide, false);} else {
this._dualPagePreviewBehavior.set_key2('');this._dualPagePreviewBehavior.set_align2(Inductronic.PhotoBookImageAlign.BestFit);this._dualPagePreviewBehavior.update(page.PageSide, false);}
}
}
}
}
}
}
},
_setImageAlign: function(origin) {
var behavior = this._currentPageBehavior;if (behavior != null) {
var page = this._findPageFromPageBehavior(behavior);if (page != null) {
if (page.PageType == Inductronic.PhotoBookPageType.Front || page.PageType == Inductronic.PhotoBookPageType.Image) {
if (page.PageSide != origin) {
behavior = this._findNextOrPreviousPageBehavior(this._currentPageBehavior);page = this._findPageFromPageBehavior(behavior);}
if (page.Images.length > 0 && page.Images[0].Align != align) {
var align = (page.Images[0].Align == Inductronic.PhotoBookImageAlign.Fill) ? Inductronic.PhotoBookImageAlign.BestFit : Inductronic.PhotoBookImageAlign.Fill;page.Images[0].Align = align;this._setPage(page);behavior.set_align(align);behavior.update(false);if (page.PageType == Inductronic.PhotoBookPageType.Front) {
this._singlePagePreviewBehavior.set_align(page.Images[0].Align);this._singlePagePreviewBehavior.update(false);} else if (page.PageType == Inductronic.PhotoBookPageType.Image) {
if (page.PageSide == Inductronic.PhotoBookPageSide.Left) {
this._dualPagePreviewBehavior.set_align1(page.Images[0].Align);this._dualPagePreviewBehavior.update(page.PageSide, false);} else {
this._dualPagePreviewBehavior.set_align2(page.Images[0].Align);this._dualPagePreviewBehavior.update(page.PageSide, false);}
}
}
}
}
}
},
_setSliderValue: function(value, bypassSlideEvent) {
var currentValue = this._scrollbarBehavior.get_value();if (value != currentValue) {
if (bypassSlideEvent) {
this._bypassSlider = true;this._scrollbarBehavior.set_value(value);this._bypassSlider = false;} else {
this._scrollbarBehavior.set_value(value);}
}
},
_getCurrent: function() {
Sys.Net.WebServiceProxy.invoke(this._servicePath, 'GetCurrent', false, null, this._onPhotoBookLoadedDelegate, null, null);},
_reset: function() {
Sys.Net.WebServiceProxy.invoke(this._servicePath, 'Reset', false, null, this._onPhotoBookLoadedDelegate, null, null);},
_setPage: function(page) {
var image = page.Images[0];var params = { index: page.Index, imageIndex: image.Index, key: image.Image, align: image.Align, title: image.Title, text: image.Text };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'SetPage', false, params, null, null, null);},
_resetByKey: function(key) {
if (key != null && key.length > 0) {
var params = { key: key };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'ResetByKey', false, params, null, null, null);}
},
_resetByIndex: function(index, imageIndex) {
if (index >= 0 && imageIndex >= 0) {
var params = { index: index, imageIndex: imageIndex };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'ResetByIndex', false, params, null, null, null);}
},
applyOptions: function(template, format, color, size, title, introText) {
var params = { template: template, format: format, color: color, size: size, title: title, introText: introText };Sys.Net.WebServiceProxy.invoke(this._servicePath, 'ApplyOptions', false, params, this._onPhotoBookLoadedDelegate, null, null);},
_onImageManagerRotateEvent: function(sender, args) {
var behavior = null;for (var i = 0;i < this._pageBehaviors.length;i++) {
behavior = this._pageBehaviors[i];if (args.key == behavior.get_key()) {
behavior.update(true);}
}
if (this._dualPagePreviewBehavior.get_key1() == args.key) {
this._dualPagePreviewBehavior.update(Inductronic.PhotoBookPageSide.Left, true);}
if (this._dualPagePreviewBehavior.get_key2() == args.key) {
this._dualPagePreviewBehavior.update(Inductronic.PhotoBookPageSide.Right, true);}
if (this._singlePagePreviewBehavior.get_key() == args.key) {
this._singlePagePreviewBehavior.update(true);}
},
_onImageManagerDeleteEvent: function(sender, args) {
var index = 0;var image = null;var page = null;var behavior = null;for (index = 0;index < this._pageBehaviors.length;index++) {
behavior = this._pageBehaviors[index];if (args.key == behavior.get_key()) {
behavior.reset();}
}
for (index = 0;index < this._currentPhotoBook.Pages.length;index++) {
page = this._currentPhotoBook.Pages[index];for (var j = 0;j < page.Images.length;j++) {
image = page.Images[j];if (args.key == image.Image) {
image.Image = '';image.Text = '';image.Title = '';image.Align = Inductronic.PhotoBookImageAlign.BestFit;}
}
}
if (this._dualPagePreviewBehavior.get_key1() == args.key) {
this._dualPagePreviewBehavior.reset(Inductronic.PhotoBookPageSide.Left);}
if (this._dualPagePreviewBehavior.get_key2() == args.key) {
this._dualPagePreviewBehavior.reset(Inductronic.PhotoBookPageSide.Right);}
if (this._singlePagePreviewBehavior.get_key() == args.key) {
this._singlePagePreviewBehavior.reset();}
this._resetByKey(args.key);},
_onImageClickPagesEvent: function(sender, args) {
if (this._isCommandsEnabled()) {
var index = sender.get_index();if (this._currentPageBehavior.get_index() != index) {
this._currentPage = index;this._createPageBySelectedIndex(index);}
this.applyImage(this._currentPageBehavior.get_key());}
},
_onImageChangedPagesEvent: function(sender, args) {
if (this._isCommandsEnabled()) {
var index = sender.get_index();if (this._currentPageBehavior.get_index() != index) {
this._currentPage = index;this._createPageBySelectedIndex(index);}
this.applyImage(this._currentPageBehavior.get_key());}
},
_onImageClickPreviewEvent: function(sender, args) {
if (this._isCommandsEnabled()) {
var index = sender.get_currentIndex();if (this._currentPageBehavior.get_index() != index) {
this._currentPage = index;this._createPageBySelectedIndex(index);}
}
},
_onImageChangedPreviewEvent: function(sender, args) {
if (this._isCommandsEnabled()) {
var index = sender.get_currentIndex();if (this._currentPageBehavior.get_index() != index) {
this._currentPage = index;this._createPageBySelectedIndex(index);}
this.applyImage(sender.get_currentKey());}
},
_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._getCurrent();}, 80);} else {
this._getCurrent();}
}
},
_onSliderStartEvent: function(evt) {
},
_onSliderEndEvent: function(evt) {
},
_onSliderSlideEvent: function(evt) {
if (!this._bypassSlider) {
this._createPageByPageIndex(this._scrollbarBehavior.get_value(), true);}
},
_onPreviousClickEvent: function(evt) {
evt.preventDefault();this._createPageByPageIndex(this._currentMiniaturePage - 1, true);},
_onNextClickEvent: function(evt) {
evt.preventDefault();this._createPageByPageIndex(this._currentMiniaturePage + 1, true);},
_onPreviousPreviewClickEvent: function(evt) {
evt.preventDefault();this._currentPage = this._findNextOrPreviousPageIndex(this._currentPage, true);this._createPageBySelectedIndex(this._currentPage);this._initializePreview(this._currentPageBehavior);},
_onNextPreviewClickEvent: function(evt) {
evt.preventDefault();this._currentPage = this._findNextOrPreviousPageIndex(this._currentPage, false);this._createPageBySelectedIndex(this._currentPage);this._initializePreview(this._currentPageBehavior);},
_onLeftAlignEvent: function(evt) {
evt.preventDefault();this._setImageAlign(Inductronic.PhotoBookPageSide.Left);},
_onLeftDeleteEvent: function(evt) {
evt.preventDefault();this._deleteImage(Inductronic.PhotoBookPageSide.Left);},
_onRightAlignEvent: function(evt) {
evt.preventDefault();this._setImageAlign(Inductronic.PhotoBookPageSide.Right);},
_onRightDeleteEvent: function(evt) {
evt.preventDefault();this._deleteImage(Inductronic.PhotoBookPageSide.Right);},
_onFormatChangedEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
}
},
_onPhotoBookLoadedEvent: function(sender, args) {
if (sender != null) {
this._currentPage = 0;this._currentMiniaturePage = -1;this._currentPhotoBook = sender;this._priceP.innerHTML = String.format('{0} <span>{1}</span>', this._pricePrefix, this._currentPhotoBook.CurrentPrice);this._initializeTemplate();this._createPageBySelectedIndex(this._currentPage);this._initializeSlider();this._initializePreview(this._currentPageBehavior);}
},
_onClearClickEvent: function(evt) {
evt.preventDefault();if (confirm(this._clearConfirmMessage)) {
this._reset();}
},
_onSettingsClickEvent: function(evt) {
evt.preventDefault();this._raiseEvent('settingsClick', 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._onPhotoBookValidateDelegate, null, null);}
},
_onAddToCartCompleteEvent: function(sender, args) {
this._enableDisableCommands(true);alert(this._addToCartCompleteMessage);},
_onPhotoBookValidateEvent: 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 };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);}
},
add_settingsClick: function(handler) {
this.get_events().addHandler('settingsClick', handler);},
remove_settingsClick: function(handler) {
this.get_events().removeHandler('settingsClick', handler);},
_raiseEvent: function(eventName, eventArgs) {
var handler = this.get_events().getHandler(eventName);if (handler) {
if (!eventArgs) {
eventArgs = Sys.EventArgs.Empty;}
handler(this, eventArgs);}
},
get_currentPhotoBook: function() {
return this._currentPhotoBook;},
get_imageRecipeBestFit: function() {
return this._imageRecipeBestFit;},
set_imageRecipeBestFit: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._imageRecipeBestFit != value) {
this._imageRecipeBestFit = value;this.raisePropertyChanged('imageRecipeBestFit');}
},
get_imagePreviewRecipeBestFit: function() {
return this._imagePreviewRecipeBestFit;},
set_imagePreviewRecipeBestFit: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._imagePreviewRecipeBestFit != value) {
this._imagePreviewRecipeBestFit = value;this.raisePropertyChanged('imagePreviewRecipeBestFit');}
},
get_imageRecipeFill: function() {
return this._imageRecipeFill;},
set_imageRecipeFill: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._imageRecipeFill != value) {
this._imageRecipeFill = value;this.raisePropertyChanged('imageRecipeFill');}
},
get_imagePreviewRecipeFill: function() {
return this._imagePreviewRecipeFill;},
set_imagePreviewRecipeFill: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._imagePreviewRecipeFill != value) {
this._imagePreviewRecipeFill = value;this.raisePropertyChanged('imagePreviewRecipeFill');}
},
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_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_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_settingsTitle: function() {
return this._settingsTitle;},
set_settingsTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._settingsTitle != value) {
this._settingsTitle = value;this.raisePropertyChanged('settingsTitle');}
},
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_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_handleImageUrl: function() {
return this._handleImageUrl;},
set_handleImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._handleImageUrl != value) {
this._handleImageUrl = value;this.raisePropertyChanged('handleImageUrl');}
},
get_nextImageUrl: function() {
return this._nextImageUrl;},
set_nextImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._nextImageUrl != value) {
this._nextImageUrl = value;this.raisePropertyChanged('nextImageUrl');}
},
get_previousImageUrl: function() {
return this._previousImageUrl;},
set_previousImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._previousImageUrl != value) {
this._previousImageUrl = value;this.raisePropertyChanged('previousImageUrl');}
},
get_deleteImageUrl: function() {
return this._deleteImageUrl;},
set_deleteImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._deleteImageUrl != value) {
this._deleteImageUrl = value;this.raisePropertyChanged('deleteImageUrl');}
},
get_alignImageUrl: function() {
return this._alignImageUrl;},
set_alignImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._alignImageUrl != value) {
this._alignImageUrl = value;this.raisePropertyChanged('alignImageUrl');}
},
get_pageCoverTitle: function() {
return this._pageCoverTitle;},
set_pageCoverTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._pageCoverTitle != value) {
this._pageCoverTitle = value;this.raisePropertyChanged('pageCoverTitle');}
},
get_pageBackTitle: function() {
return this._pageBackTitle;},
set_pageBackTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._pageBackTitle != value) {
this._pageBackTitle = value;this.raisePropertyChanged('pageBackTitle');}
},
get_pageTitleFormat: function() {
return this._pageTitleFormat;},
set_pageTitleFormat: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._pageTitleFormat != value) {
this._pageTitleFormat = value;this.raisePropertyChanged('pageTitleFormat');}
},
get_pagePairTitleFormat: function() {
return this._pagePairTitleFormat;},
set_pagePairTitleFormat: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._pagePairTitleFormat != value) {
this._pagePairTitleFormat = value;this.raisePropertyChanged('pagePairTitleFormat');}
},
get_pageTextTitle: function() {
return this._pageTextTitle;},
set_pageTextTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._pageTextTitle != value) {
this._pageTextTitle = value;this.raisePropertyChanged('pageTextTitle');}
},
get_pageEmptyTitle: function() {
return this._pageEmptyTitle;},
set_pageEmptyTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._pageEmptyTitle != value) {
this._pageEmptyTitle = value;this.raisePropertyChanged('pageEmptyTitle');}
}
}
Inductronic.PhotoBookBehavior.registerClass('Inductronic.PhotoBookBehavior', Sys.UI.Control, Sys.IDisposable );Inductronic.PageBehavior = function(element) {
Inductronic.PageBehavior.initializeBase(this, [element]);this._align = Inductronic.PhotoBookImageAlign.BestFit;this._caption = '';this._enabled = true;this._key = '';this._index = -1;this._imageRecipeBestFit = '';this._imageRecipeFill = '';this._preloadImageUrl = '';this._onImageChangedExternalDelegate = null;this._onImageClickExternalDelegate = null;this._previewImage = null;this._previewImageBehavior = null;this._titleSpan = null;}
Inductronic.PageBehavior.prototype = {
initialize : function() {
Inductronic.PageBehavior.callBaseMethod(this, 'initialize');if(this._onImageChangedExternalDelegate === null)
{
this._onImageChangedExternalDelegate = Function.createDelegate(this, this._onImageChangedExternalEvent);}
if(this._onImageClickExternalDelegate === null)
{
this._onImageClickExternalDelegate = Function.createDelegate(this, this._onImageClickExternalEvent);} 
var parent = null;var current = null;var el = this.get_element();current = document.createElement('div');el.appendChild(current);this._previewImage = document.createElement('img');current.appendChild(this._previewImage);this._previewImage.id = this._generateId(String.format('pw_{0}',this._index));this._previewImage.alt = '';$common.setVisible(this._previewImage,false);this._previewImageBehavior = $create(Inductronic.DropTargetImageBehavior, {id: this._previewImage.id, imageRecipe : this._imageRecipeBestFit, preloadImageUrl: this._preloadImageUrl, index: this._index }, { imageChanged : this._onImageChangedExternalDelegate, imageClick : this._onImageClickExternalDelegate }, null, this._previewImage );current = document.createElement('div');el.appendChild(current);Sys.UI.DomElement.addCssClass(current, 'clear');this._titleSpan = document.createElement('span');el.appendChild(this._titleSpan);current = document.createElement('div');el.appendChild(current);Sys.UI.DomElement.addCssClass(current, 'clear');}, 
dispose : function() { 
$clearHandlers(this.get_element());if(this._onImageChangedExternalDelegate )
{
delete this._onImageChangedExternalDelegate;this._onImageChangedExternalDelegate = null;}
if(this._onImageClickExternalDelegate )
{
delete this._onImageClickExternalDelegate;this._onImageClickExternalDelegate = null;}
Inductronic.PageBehavior.callBaseMethod(this, 'dispose');},
_generateId : function(id) {
return this.get_id() + '_' + id;},
_onImageClickExternalEvent : function(sender,args) {
if(this._enabled) {
this._raiseEvent('imageClick', args);}
},
_onImageChangedExternalEvent : function(sender,args) {
if(this._enabled) {
var key = sender.get_key();if(key != null && key.length > 0) {
this.set_key(key);}
this._raiseEvent('imageChanged', args);}
},
add_imageClick : function(handler) {
this.get_events().addHandler('imageClick', handler);}, 
remove_imageClick : function(handler) {
this.get_events().removeHandler('imageClick', handler);},
add_imageChanged : function(handler) {
this.get_events().addHandler('imageChanged', handler);}, 
remove_imageChanged : function(handler) {
this.get_events().removeHandler('imageChanged', handler);}, 
_raiseEvent : function(eventName, eventArgs) { 
var handler = this.get_events().getHandler(eventName);if (handler) { 
if (!eventArgs) { 
eventArgs = Sys.EventArgs.Empty;} 
handler(this, eventArgs);} 
},
update : function(force) {
this._removeCSS();this._applyCSS();this._previewImageBehavior.set_imageRecipe(this._align == Inductronic.PhotoBookImageAlign.Fill ? this._imageRecipeFill : this._imageRecipeBestFit );this._previewImageBehavior.set_enabled(this._enabled);this._previewImageBehavior.set_index(this._index);this._previewImageBehavior.set_key(this._key);this._previewImageBehavior.update();},
_applyCSS : function() {
var el = this.get_element();if(this._index == 0) {
Sys.UI.DomElement.addCssClass(el, 'first');} else if(this._index == 1) {
Sys.UI.DomElement.addCssClass(el, 'second');} else { 
Sys.UI.DomElement.addCssClass(el, ( this._index % 2 == 0 ) ? 'spread_1' : 'spread_2');}
this._titleSpan.innerHTML = this._caption;},
_removeCSS : function() {
var el = this.get_element();if(Sys.UI.DomElement.containsCssClass(el, 'first')) {
Sys.UI.DomElement.removeCssClass(el, 'first')
}
if(Sys.UI.DomElement.containsCssClass(el, 'second')) {
Sys.UI.DomElement.removeCssClass(el, 'second')
}
if(Sys.UI.DomElement.containsCssClass(el, 'spread_1')) {
Sys.UI.DomElement.removeCssClass(el, 'spread_1')
}
if(Sys.UI.DomElement.containsCssClass(el, 'spread_2')) {
Sys.UI.DomElement.removeCssClass(el, 'spread_2')
}
},
reset : function() {
this._removeCSS();this._previewImageBehavior.set_enabled(this._enabled);this._align = Inductronic.PhotoBookImageAlign.BestFit;this._previewImageBehavior.set_imageRecipe(this._align == Inductronic.PhotoBookImageAlign.Fill ? this._imageRecipeFill : this._imageRecipeBestFit );this._previewImageBehavior.reset();this._applyCSS();},
show : function() {
var el = this.get_element();if(!$common.getVisible(el)) {
$common.setVisible(el,true);} 
},
hide : function() {
var el = this.get_element();if($common.getVisible(el)) {
$common.setVisible(el,false);} 
},
select : function() {
if(this._enabled) {
this._previewImageBehavior.select();}
},
deselect : function() {
this._previewImageBehavior.deselect();},
get_align : function() {
return this._align;}, 
set_align : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Number }]);if (e) throw e;if (this._align != value) {
this._align = value;this.raisePropertyChanged('align');}
},
get_enabled : function() {
return this._enabled;}, 
set_enabled : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Boolean }]);if (e) throw e;if (this._enabled != value) {
this._enabled = value;this.raisePropertyChanged('enabled');}
},
get_caption : function() {
return this._caption;}, 
set_caption : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._caption != value) {
this._caption = value;this.raisePropertyChanged('caption');}
}, 
get_key : function() {
return this._key;}, 
set_key : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._key != value) {
this._key = value;this.raisePropertyChanged('key');}
}, 
get_index : function() {
return this._index;}, 
set_index : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Number}]);if (e) throw e;if (this._index != value) {
this._index = value;this.raisePropertyChanged('index');}
}, 
get_imageRecipeBestFit : function() {
return this._imageRecipeBestFit;}, 
set_imageRecipeBestFit : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._imageRecipeBestFit != value) {
this._imageRecipeBestFit = value;this.raisePropertyChanged('imageRecipeBestFit');}
}, 
get_imageRecipeFill : function() {
return this._imageRecipeFill;}, 
set_imageRecipeFill : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._imageRecipeFill != value) {
this._imageRecipeFill = value;this.raisePropertyChanged('imageRecipeFill');}
}, 
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');}
} 
}
Inductronic.PageBehavior.registerClass('Inductronic.PageBehavior', AjaxControlToolkit.BehaviorBase, Sys.IDisposable);Inductronic.SinglePagePreviewBehavior = function(element) {
Inductronic.SinglePagePreviewBehavior.initializeBase(this, [element]);this._align = Inductronic.PhotoBookImageAlign.BestFit;this._enabled = true;this._index = -1;this._key = '';this._imageRecipeBestFit = '';this._imageRecipeFill = '';this._preloadImageUrl = '';this._onImageChangedExternalDelegate = null;this._onImageClickExternalDelegate = null;this._previewImageBehavior = null;this._previewImage = null;this._title = '';this._pageTitleP = null;}
Inductronic.SinglePagePreviewBehavior.prototype = {
initialize : function() {
Inductronic.SinglePagePreviewBehavior.callBaseMethod(this, 'initialize');if(this._onImageChangedExternalDelegate === null)
{
this._onImageChangedExternalDelegate = Function.createDelegate(this, this._onImageChangedExternalEvent);}
if(this._onImageClickExternalDelegate === null)
{
this._onImageClickExternalDelegate = Function.createDelegate(this, this._onImageClickExternalEvent);} 
var el = this.get_element();Sys.UI.DomElement.addCssClass(el, 'frame front');var previewPageFront = document.createElement('div');el.appendChild(previewPageFront);Sys.UI.DomElement.addCssClass(previewPageFront, 'pagefront');var imgframe = document.createElement('div');previewPageFront.appendChild(imgframe);Sys.UI.DomElement.addCssClass(imgframe, 'imgframe');this._previewImage = document.createElement('img');imgframe.appendChild(this._previewImage);this._previewImage.id = this._generateId('dt');this._previewImage.alt = '';$common.setVisible(this._previewImage,false);this._previewImageBehavior = $create(Inductronic.DropTargetImageBehavior, {id: this._previewImage.id, imageRecipe : this._imageRecipeBestFit, preloadImageUrl: this._preloadImageUrl }, { imageChanged : this._onImageChangedExternalDelegate, imageClick : this._onImageClickExternalDelegate }, null, this._previewImage );this._pageTitleP = document.createElement('p');previewPageFront.appendChild(this._pageTitleP);this._pageTitleP.innerHTML = '';}, 
dispose : function() { 
$clearHandlers(this.get_element());if(this._onImageChangedExternalDelegate )
{
delete this._onImageChangedExternalDelegate;this._onImageChangedExternalDelegate = null;}
if(this._onImageClickExternalDelegate )
{
delete this._onImageClickExternalDelegate;this._onImageClickExternalDelegate = null;}
Inductronic.SinglePagePreviewBehavior.callBaseMethod(this, 'dispose');},
_generateId : function(id) {
return this.get_id() + '_' + id;},
update : function(force) {
this._pageTitleP.innerHTML = String.format('<strong>{0}</strong>',this._title);this._previewImageBehavior.set_imageRecipe(this._align == Inductronic.PhotoBookImageAlign.Fill ? this._imageRecipeFill : this._imageRecipeBestFit );this._previewImageBehavior.set_enabled(this._enabled);this._previewImageBehavior.set_index(this._index);this._previewImageBehavior.set_key(this._key);this._previewImageBehavior.update();},
reset : function() {
this._index = -1;this._key = '';this._align = Inductronic.PhotoBookImageAlign.BestFit;this._previewImageBehavior.set_imageRecipe(this._align == Inductronic.PhotoBookImageAlign.Fill ? this._imageRecipeFill : this._imageRecipeBestFit );this._previewImageBehavior.set_index(this._index);this._previewImageBehavior.set_enabled(this._enabled);this._previewImageBehavior.reset();},
select : function() {
if(this._enabled) {
this._previewImageBehavior.select();}
},
deselect : function() {
this._previewImageBehavior.deselect();},
show : function() {
var el = this.get_element();if(!$common.getVisible(el)) {
$common.setVisible(el,true);} 
},
hide : function() {
var el = this.get_element();if($common.getVisible(el)) {
$common.setVisible(el,false);} 
},
_onImageChangedExternalEvent : function(sender,args) {
if(this._enabled) {
var key = sender.get_key();if(key != null && key.length > 0) {
this.set_key(key);}
this._raiseEvent('imageChanged', args);}
},
_onImageClickExternalEvent : function(sender,args) {
if(this._enabled) {
this._raiseEvent('imageClick', args);}
},
add_imageChanged : function(handler) {
this.get_events().addHandler('imageChanged', handler);}, 
remove_imageChanged : function(handler) {
this.get_events().removeHandler('imageChanged', handler);},
add_imageClick : function(handler) {
this.get_events().addHandler('imageClick', handler);}, 
remove_imageClick : function(handler) {
this.get_events().removeHandler('imageClick', handler);}, 
_raiseEvent : function(eventName, eventArgs) { 
var handler = this.get_events().getHandler(eventName);if (handler) { 
if (!eventArgs) { 
eventArgs = Sys.EventArgs.Empty;} 
handler(this, eventArgs);} 
},
get_align : function() {
return this._align;}, 
set_align : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Number }]);if (e) throw e;if (this._align != value) {
this._align = value;this.raisePropertyChanged('align');}
},
get_enabled : function() {
return this._enabled;}, 
set_enabled : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Boolean }]);if (e) throw e;if (this._enabled != value) {
this._enabled = value;this.raisePropertyChanged('enabled');}
},
get_currentIndex : function() {
return this._index;},
get_currentKey : function() {
return this._key;},
get_index : function() {
return this._index;}, 
set_index : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Number}]);if (e) throw e;if (this._index != value) {
this._index = value;this.raisePropertyChanged('index');}
}, 
get_title : function() {
return this._title;},
set_title : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._title != value) {
this._title = value;this.raisePropertyChanged('title');}
}, 
get_key : function() {
return this._key;},
set_key : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._key != value) {
this._key = value;this.raisePropertyChanged('key');}
}, 
get_imageRecipeBestFit : function() {
return this._imageRecipeBestFit;},
set_imageRecipeBestFit : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._imageRecipeBestFit != value) {
this._imageRecipeBestFit = value;this.raisePropertyChanged('imageRecipeBestFit');}
}, 
get_imageRecipeFill : function() {
return this._imageRecipeFill;}, 
set_imageRecipeFill : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._imageRecipeFill != value) {
this._imageRecipeFill = value;this.raisePropertyChanged('imageRecipeFill');}
}, 
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');}
} 
}
Inductronic.SinglePagePreviewBehavior.registerClass('Inductronic.SinglePagePreviewBehavior', AjaxControlToolkit.BehaviorBase, Sys.IDisposable);Inductronic.DualPagePreviewBehavior = function(element) {
Inductronic.DualPagePreviewBehavior.initializeBase(this, [element]);this._align1 = Inductronic.PhotoBookImageAlign.BestFit;this._align2 = Inductronic.PhotoBookImageAlign.BestFit;this._currentIndex = -1;this._currentKey = '';this._index1 = -1;this._index2 = -1;this._key1 = '';this._key2 = '';this._enabled = true;this._imageRecipeBestFit = '';this._imageRecipeFill = '';this._preloadImageUrl = '';this._onImageChangedExternalDelegate = null;this._onImageClickExternalDelegate = null;this._previewImageBehavior1 = null;this._previewImageBehavior2 = null;}
Inductronic.DualPagePreviewBehavior.prototype = {
initialize : function() {
Inductronic.DualPagePreviewBehavior.callBaseMethod(this, 'initialize');if(this._onImageChangedExternalDelegate === null)
{
this._onImageChangedExternalDelegate = Function.createDelegate(this, this._onImageChangedExternalEvent);}
if(this._onImageClickExternalDelegate === null)
{
this._onImageClickExternalDelegate = Function.createDelegate(this, this._onImageClickExternalEvent);}
var el = this.get_element();Sys.UI.DomElement.addCssClass(el, 'frame');$common.setVisible(el, false);var firstPage = document.createElement('div');el.appendChild(firstPage);Sys.UI.DomElement.addCssClass(firstPage, 'page_first');var previewImage1 = document.createElement('img');firstPage.appendChild(previewImage1);previewImage1.id = this._generateId('dt1');previewImage1.alt = '';$common.setVisible(previewImage1,false);this._previewImageBehavior1 = $create(Inductronic.DropTargetImageBehavior, {id: previewImage1.id, imageRecipe : this._imageRecipeBestFit, preloadImageUrl: this._preloadImageUrl, index: 1 }, { imageChanged : this._onImageChangedExternalDelegate, imageClick : this._onImageClickExternalDelegate }, null, previewImage1 );var secondPage = document.createElement('div');el.appendChild(secondPage);Sys.UI.DomElement.addCssClass(secondPage, 'page_second');previewImage2 = document.createElement('img');secondPage.appendChild(previewImage2);previewImage2.id = this._generateId('dt2');previewImage2.alt = '';$common.setVisible(previewImage2,false);this._previewImageBehavior2 = $create(Inductronic.DropTargetImageBehavior, {id: previewImage2.id, imageRecipe : this._imageRecipeBestFit, preloadImageUrl: this._preloadImageUrl, index: 2 }, { imageChanged : this._onImageChangedExternalDelegate, imageClick : this._onImageClickExternalDelegate }, null, previewImage2 );}, 
dispose : function() {
$clearHandlers(this.get_element());if(this._onImageChangedExternalDelegate )
{
delete this._onImageChangedExternalDelegate;this._onImageChangedExternalDelegate = null;}
if(this._onImageClickExternalDelegate )
{
delete this._onImageClickExternalDelegate;this._onImageClickExternalDelegate = null;}
Inductronic.DualPagePreviewBehavior.callBaseMethod(this, 'dispose');},
_generateId : function(id) {
return this.get_id() + '_' + id;},
update : function(side,force) {
if(side == Inductronic.PhotoBookPageSide.Left) { 
this._previewImageBehavior1.set_enabled(this._enabled);this._previewImageBehavior1.set_imageRecipe(this._align1 == Inductronic.PhotoBookImageAlign.Fill ? this._imageRecipeFill : this._imageRecipeBestFit );this._previewImageBehavior1.set_index(this._index1);this._previewImageBehavior1.set_key(this._key1);this._previewImageBehavior1.update();} else {
this._previewImageBehavior2.set_enabled(this._enabled);this._previewImageBehavior2.set_imageRecipe(this._align2 == Inductronic.PhotoBookImageAlign.Fill ? this._imageRecipeFill : this._imageRecipeBestFit );this._previewImageBehavior2.set_index(this._index2);this._previewImageBehavior2.set_key(this._key2);this._previewImageBehavior2.update();}
},
reset : function(side) {
this._currentIndex = -1;this._currentKey = '';if(side == Inductronic.PhotoBookPageSide.Left) {
this._key1 = '';this._index1 = -1;this._align1 = Inductronic.PhotoBookImageAlign.BestFit;this._previewImageBehavior1.set_imageRecipe(this._align1 == Inductronic.PhotoBookImageAlign.Fill ? this._imageRecipeFill : this._imageRecipeBestFit );this._previewImageBehavior1.set_index(this._index1);this._previewImageBehavior1.set_enabled(this._enabled);this._previewImageBehavior1.reset();} else {
this._key2 = '';this._index2 = -1;this._align2 = Inductronic.PhotoBookImageAlign.BestFit;this._previewImageBehavior2.set_imageRecipe(this._align2 == Inductronic.PhotoBookImageAlign.Fill ? this._imageRecipeFill : this._imageRecipeBestFit );this._previewImageBehavior2.set_index(this._index2);this._previewImageBehavior2.set_enabled(this._enabled);this._previewImageBehavior2.reset();}
},
select : function(side) {
if(this._enabled) {
if(side == Inductronic.PhotoBookPageSide.Left) {
this._previewImageBehavior2.deselect();this._previewImageBehavior1.select();} else {
this._previewImageBehavior1.deselect();this._previewImageBehavior2.select();}
}
},
deselect : function(side) {
if(side == Inductronic.PhotoBookPageSide.Left) {
this._previewImageBehavior1.deselect();} else {
this._previewImageBehavior2.deselect();}
},
show : function() {
var el = this.get_element();if(!$common.getVisible(el)) {
$common.setVisible(el,true);} 
},
hide : function() {
var el = this.get_element();if($common.getVisible(el)) {
$common.setVisible(el,false);} 
},
_onImageChangedExternalEvent : function(sender,args) {
if(this._enabled) {
var key = sender.get_key();var index = sender.get_index();this._currentIndex = index;this._currentKey = key != null ? key : '';if(key != null && key.length > 0) {
if(index == this._index1) {
this.set_key1(key);} else if(index == this._index2) { 
this.set_key2(key);}
}
this._raiseEvent('imageChanged', args);}
},
_onImageClickExternalEvent : function(sender,args) {
if(this._enabled) {
var index = sender.get_index();var key = sender.get_key();this._currentIndex = index;this._currentKey = key != null ? key : '';this._raiseEvent('imageClick', args);}
},
add_imageChanged : function(handler) {
this.get_events().addHandler('imageChanged', handler);}, 
remove_imageChanged : function(handler) {
this.get_events().removeHandler('imageChanged', handler);},
add_imageClick : function(handler) {
this.get_events().addHandler('imageClick', handler);}, 
remove_imageClick : function(handler) {
this.get_events().removeHandler('imageClick', handler);}, 
_raiseEvent : function(eventName, eventArgs) { 
var handler = this.get_events().getHandler(eventName);if (handler) { 
if (!eventArgs) { 
eventArgs = Sys.EventArgs.Empty;} 
handler(this, eventArgs);} 
},
get_currentIndex : function() {
return this._currentIndex;},
get_currentKey : function() {
return this._currentKey;}, 
get_align1 : function() {
return this._align1;}, 
set_align1 : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Number }]);if (e) throw e;if (this._align1 != value) {
this._align1 = value;this.raisePropertyChanged('align1');}
},
get_align2 : function() {
return this._align2;}, 
set_align2 : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Number }]);if (e) throw e;if (this._align2 != value) {
this._align2 = value;this.raisePropertyChanged('align2');}
},
get_index1 : function() {
return this._index1;},
set_index1 : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Number }]);if (e) throw e;if (this._index1 != value) {
this._index1 = value;this.raisePropertyChanged('index1');}
},
get_index2 : function() {
return this._index2;},
set_index2 : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Number }]);if (e) throw e;if (this._index2 != value) {
this._index2 = value;this.raisePropertyChanged('index2');}
},
get_key1 : function() {
return this._key1;},
set_key1 : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._key1 != value) {
this._key1 = value;this.raisePropertyChanged('key1');}
},
get_key2 : function() {
return this._key2;},
set_key2 : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._key2 != value) {
this._key2 = value;this.raisePropertyChanged('key2');}
}, 
get_enabled : function() {
return this._enabled;}, 
set_enabled : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: Boolean }]);if (e) throw e;if (this._enabled != value) {
this._enabled = value;this.raisePropertyChanged('enabled');}
},
get_imageRecipeBestFit : function() {
return this._imageRecipeBestFit;}, 
set_imageRecipeBestFit : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._imageRecipeBestFit != value) {
this._imageRecipeBestFit = value;this.raisePropertyChanged('imageRecipeBestFit');}
},
get_imageRecipeFill : function() {
return this._imageRecipeFill;}, 
set_imageRecipeFill : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._imageRecipeFill != value) {
this._imageRecipeFill = value;this.raisePropertyChanged('imageRecipeFill');}
}, 
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');}
} 
}
Inductronic.DualPagePreviewBehavior.registerClass('Inductronic.DualPagePreviewBehavior', AjaxControlToolkit.BehaviorBase, Sys.IDisposable);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();