if(!esg)var esg={};if(!esg.viewUtil)
esg.viewUtil={};esg.viewUtil.modalBox={show:function(modalDiv,skipOverlay){this.modalDivId=modalDiv;if(!$('modal_overlay')){var overlay=new Element('div',{'id':'modal_overlay'});var root=document.body;if(Browser.Engine.trident4||Browser.Engine.trident5)
root=$('principal')||document.body;root.appendChild(overlay);}
if(Browser.Engine.trident4){this.getScroll();this.prepareIE('100%','hidden');this.setScroll(0,0);this.hideSelects('hidden');if($('closeBtn'))
{$('closeBtn').style.zIndex=4000;}
$('modal_overlay').style.height=esg.viewUtil.getPageSize()[1];}
if(!skipOverlay)
$("modal_overlay").style.display="block";$(modalDiv).style.display="block";},hide:function(modalDiv,skipOverlay){if(Browser.Engine.trident4){this.setScroll(0,this.yPos);this.prepareIE("auto","auto");}
if(!skipOverlay){$("modal_overlay").style.display="none";this.hideSelects("visible");}
if($(modalDiv))$(modalDiv).style.display="none";},prepareIE:function(height,overflow){bod=document.getElementsByTagName('body')[0];bod.style.height=height;bod.style.overflow=overflow;},getScroll:function(){var yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;}
else
if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;}
else
if(document.body){yScroll=document.body.scrollTop;}
this.yPos=yScroll;},setScroll:function(x,y){window.scrollTo(x,y);},hideSelects:function(visibility){if(visibility=='visible')
visibility='';var selects=$$('select');selects.each(function(item,index){if(!item.getParent('#'+esg.viewUtil.modalBox.modalDivId))
item.style.visibility=visibility;});}};esg.viewUtil.throbber={show:function(){if(!$("progressThrobber")){var dlg=new Element('div',{'class':"dialogbox",'id':"progressThrobber"});dlg.innerHTML='<div class="dialogtopleft"><div class="dialogtopright clearfix"><div class="throbberContent"><img src="'+esg.viewUtil.staticAssetPath+'/Kodak_Gallery_Media/ECBO/images/icons/throbber.gif" alt="In Progress"/><br/><h3>Loading</h3>Please wait...</div></div></div><div class="dialogbotright"><div class="dialogbotleft"></div></div>';if(Browser.Engine.trident4){dlg.setStyle('top',$(document.body).getScroll().y+$(document.body).getSize().y/2-dlg.getSize().y);}
if($('principal')){$('principal').appendChild(dlg);}
else{$(document.body).appendChild(dlg);}}
if(Browser.Engine.trident4){$(document.body).addClass('hideSelect');}
$("progressThrobber").style.display="block";},hide:function(){if(Browser.Engine.trident4){$(document.body).removeClass('hideSelect');}
if($('progressThrobber')){$("progressThrobber").style.display="none";}}};esg.viewUtil.modalThrobber={moOverlayed:false,show:function(elevateModelOverlay){this.moOverlayed=$chk(elevateModelOverlay);if(!$("progressThrobber")){var dlg=new Element('div',{'class':"dialogbox",'id':"progressThrobber"});dlg.innerHTML='<div class="dialogtopleft"><div class="dialogtopright clearfix"><div class="throbberContent"><img src="'+esg.viewUtil.staticAssetPath+'/Kodak_Gallery_Media/ECBO/images/icons/throbber.gif" alt="In Progress"/><br/><h3>Loading</h3>Please wait...</div></div></div><div class="dialogbotright"><div class="dialogbotleft"></div></div>';if($('principal')){$('principal').appendChild(dlg);}
else{$(document.body).appendChild(dlg);}}
esg.viewUtil.modalBox.show($("progressThrobber"));if(this.moOverlayed){$("modal_overlay").setStyle('z-index','3001');}},hide:function(){if($('progressThrobber')){esg.viewUtil.modalBox.hide($('progressThrobber'));if(this.moOverlayed){$("modal_overlay").setStyle('display','block');$("modal_overlay").setStyle('z-index','1000');}}}};esg.viewUtil.serviceError={show:function(){if(!$("serviceError")){var dlg=new Element('div',{'class':"dialogbox",'id':"serviceError"});dlg.innerHTML='<div class="dialogtopleft"><div class="dialogtopright clearfix"><div class="errorContent"><h3></h3><p><b> We were unable to process your request. <br/> Please try again.</b></p> <a id="closeServiceError" href="#" class="linkbutton"><span>OK</span></a></div></div></div><div class="dialogbotright"><div class="dialogbotleft"></div></div>';if(Browser.Engine.trident4){dlg.setStyle('top',$(document.body).getScroll().y+$(document.body).getSize().y/2-dlg.getSize().y);}
$('principal').appendChild(dlg);$("closeServiceError").addEvent('click',esg.viewUtil.serviceError.hide);}
$("serviceError").style.display="block";},hide:function(event){if(event)event.stop();$("serviceError").style.display="none";}};esg.viewUtil.timeoutError={show:function(){if(!$("timeoutError")){var dlg=new Element('div',{'class':"dialogbox",'id':"timeoutError"});dlg.innerHTML='<div class="dialogtopleft"><div class="dialogtopright clearfix"><div class="errorContent"><h3>Session Time-Out</h3><p>Your session has expired.<br/>Please start a new session.</p><a id="closeTimeoutError" href="#" class="linkbutton"><span>OK</span></a></div></div></div><div class="dialogbotright"><div class="dialogbotleft"></div></div>';if(Browser.Engine.trident4){dlg.setStyle('top',$(document.body).getScroll().y+$(document.body).getSize().y/2-dlg.getSize().y);}
$('principal').appendChild(dlg);$("closeTimeoutError").addEvent('click',esg.viewUtil.timeoutError.hide);}
$("timeoutError").style.display="block";},hide:function(event){if(event)event.stop();$("timeoutError").style.display="none";document.location="/";}};esg.viewUtil.customError={show:function(params){var header=params.title?params.title:'Error';var hideHeader=(params.hideHeader)?params.hideHeader:false
var message=params.message;var dlg=$("customError");if(!dlg){dlg=new Element('div',{'class':"dialogbox",'id':"customError"});}else{$("customError").style.display='none';}
dlg.innerHTML='<div class="dialogtopleft"><div class="dialogtopright clearfix"><div class="errorContent">'+((!hideHeader)?('<h3>'+header+'</h3>'):'')+'<p>'+message+'</p><a id="closeCustomError" href="#" class="linkbutton"><span>OK</span></a></div></div></div><div class="dialogbotright"><div class="dialogbotleft"></div></div>';if(Browser.Engine.trident4){}
$('principal').appendChild(dlg);$("closeCustomError").addEvent('click',esg.viewUtil.customError.hide);if(hideHeader&&!$('customError').hasClass('hideHeader'))
$('customError').addClass('hideHeader');else if(!hideHeader&&$('customError').hasClass('hideHeader'))
$('customError').removeClass('hideHeader');$("customError").style.display="block";},hide:function(event){if(event)event.stop();$("customError").style.display="none";}};esg.viewUtil.deleteGuard={show:function(param,param2){if(!param2)
param2='You will not be able to undo this action.';if(param=='photo')
param2='This photo will be permanently deleted from the album and any Slideshow in which it has been placed.';if(!$("deleteGuard")){var dlg=new Element('div',{id:'deleteGuard','class':'dialogbox'});dlg.innerHTML='<div class="dialogtopleft"><div class="dialogtopright clearfix"><div class="throbberContent"><h4></h4><p>'+param2+'</p><div class="options"><a class="linkbutton secondarybutton" id="btnConfirmDelete" href="#"><span>Delete</span></a><a class="linkbutton tertiarybutton" id="btnCancelDelete" href="#"><span>Cancel</span></a></div></div></div></div><div class="dialogbotright"><div class="dialogbotleft"></div></div>';if(Browser.Engine.trident4){dlg.setStyle('top',$(document.body).getScroll().y+$(document.body).getSize().y/2-dlg.getSize().y);}
if($('principal')){$('principal').appendChild(dlg);}
else{$(document.body).appendChild(dlg);}
}
$$("#deleteGuard h4")[0].innerHTML='Are you sure you want to delete this '+param+'?';$$('#deleteGuard .throbberContent p')[0].innerHTML=param2;$("deleteGuard").style.display="block";$$('#deleteGuard a').removeEvents('click');},hide:function(event){if(event)event.stop();$("deleteGuard").style.display="none";}};esg.viewUtil.fixFooter=function(){}
esg.viewUtil.getTabbedNavBarContents=function(current){if(!current)current='photos';var upload='<a href="javascript:void(0);" id="btnUpload" class="linkbutton secondarybutton"><span id="photoPickerButtonUpload">Upload Photos</span></a>';var ancillary=new Element('div',{'class':'ancillary','html':(current=='photos')?upload:''});var subtabs=new Element('ul',{'class':'subtabs'});var anon=esg.ident.model.isAnon;var photostab=new Element('li',{'class':'photostab '+((current=='photos')?'current':''),'html':'<a href="albums.jsp"><span id="photoPickerPhotos">Photos</span></a>'});var contactstab=new Element('li',{'class':'contactstab '+((current=='contacts')?'current':'')+((anon)?'disabled':'')});var contactstaba=new Element('a',{'id':'contactsTabLink','href':(anon)?'javascript:void(0);':'contacts.jsp','html':'<span id="photoPickerContacts">Contacts</span>'});var commentstab=new Element('li',{'class':'commentstab '+((current=='comments')?'current':'')+((anon)?'disabled':'')});var commentstaba=new Element('a',{'id':'commentsTabLink','href':(anon)?'javascript:void(0);':'comments.jsp','html':'<span id="photoPickerComments">Comments</span>'});var sharehistorytab=new Element('li',{'class':'sharehistorytab '+((current=='sharedHistory')?'current':'')+((anon)?'disabled':'')});var sharehistorytaba=new Element('a',{'id':'shareHistoryTabLink','href':(anon)?'javascript:void(0);':'sharedHistory.jsp','html':'<span id="photoPickerShareHistory">Share History</span>'});var projectstab=new Element('li',{'class':'projectstab '});var projectstaba=new Element('a',{'id':'projectsTabLink','href':'/gallery/my-photo-projects.jsp','html':'<span>My Projects</span>'});if(anon){var addTabLinks=function(){if(!$('shareHistoryTabLink')){addTabLinks.delay(500);return;}
var anonAlert=function(e){esg.share.controller.execute('showError',{'message':'You must be logged in to access this tab.'});return false;};$('contactsTabLink').addEvent('click',anonAlert);$('commentsTabLink').addEvent('click',anonAlert);$('shareHistoryTabLink').addEvent('click',anonAlert);}
window.addEvent('domready',addTabLinks);}
contactstab.appendChild(contactstaba);commentstab.appendChild(commentstaba);sharehistorytab.appendChild(sharehistorytaba);subtabs.appendChild(photostab);subtabs.appendChild(contactstab);subtabs.appendChild(commentstab);subtabs.appendChild(sharehistorytab);var wrapper=new Element('div');wrapper.appendChild(subtabs);wrapper.appendChild(ancillary);return wrapper.getHTML();}
esg.viewUtil.photoResize=function(photo,max){var orig_width=photo.width,orig_height=photo.height;if(!max)max=250;if(photo.width>photo.height){if(photo.width>max){photo.width=max;photo.height=orig_height*(max/orig_width);}}else{if(photo.height>max){photo.height=max;photo.width=orig_width*(max/orig_height);};}
return photo;}
esg.viewUtil.getPageSize=function(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;}
esg.viewUtil.inPlaceEditor={show:function(params){var origText=params.edit;var editText=origText.replace(/<br\/*>/gi,"\r\n");var onCompleteEditEventStr=params.callback;var editTxtFld=new Element('textarea',{'id':'inPlaceEditor','class':'texteditfield','html':Browser.Engine.trident?'':editText,'events':{select:function(event){event.stop();if(!Browser.Engine.trident)
esg.utility.txtCharCount('inPlaceEditor','editTextLengthCounter',500);return false;},focus:function(event){event.stop();esg.utility.txtCharCount('inPlaceEditor','editTextLengthCounter',500);return false;},keyup:function(){esg.utility.txtCharCount('inPlaceEditor','editTextLengthCounter',500);}}});editTxtFld.store('origText',editText);if(Browser.Engine.trident){editTxtFld.value=esg.utility.decodeHTML(editText);}
var textLengthCounter=new Element('span',{'id':'editTextLengthCounter','class':'textlength'})
var saveEdit=new Element('a',{'id':'saveInPlaceEdit','class':'saveInPlaceEdit','html':'Save','events':{click:function(event){event.stop();var newText=$('inPlaceEditor').value;if(editText==newText){esg.viewUtil.inPlaceEditor.cancel();}
else{esg.viewUtil.inPlaceEditor.save(onCompleteEditEventStr);}
return false;}}})
var cancelEdit=new Element('a',{'id':'cancelInPlaceEdit','class':'cancelInPlaceEdit','html':'Cancel','events':{click:function(event){event.stop();esg.viewUtil.inPlaceEditor.cancel();return false;}}})
var inPleaceEditor=new Element('div',{'id':'inPlaceEditContainer','class':'inplaceeditor'}).adopt([textLengthCounter,cancelEdit,saveEdit,editTxtFld]);return inPleaceEditor;},save:function(callbackstr){if(callbackstr){console.info(callbackstr);eval(callbackstr);}},cancel:function(){var origComment=($('inPlaceEditor'))?$('inPlaceEditor').retrieve('origText'):'';var commentTextFld=$('inPlaceEditor').getParent('.commentText');commentTextFld.removeClass('editmode');commentTextFld.innerHTML=origComment.replace(/\r\n/g,"<br/>");esg.share.model.editing=false;}}
esg.viewUtil.keepPhotoPullerMonitorInView=function(){var ppmDlg=$('photoPullerMonitorInView_dialog');var modalOverlay=$('modal_overlay');if(ppmDlg){var dlgWidth=ppmDlg.getSize().x;var dlgHeight=ppmDlg.getSize().y;var dlgMarginLeft=parseInt(ppmDlg.getStyle('margin-left'));var dlgMarginTop=parseInt(ppmDlg.getStyle('margin-top'));var docWidth=document.getSize().x;var docHeight=document.getSize().y;var docScrollX=document.getScroll().x;var docScrollY=document.getScroll().y;var newLeft=docScrollX+(docWidth-dlgWidth)/2-dlgMarginLeft;var newTop=docScrollY+(docHeight-dlgHeight)/2-dlgMarginTop;ppmDlg.setStyles({'left':'50%','top':'320px'});if(modalOverlay){modalOverlay.setStyles({'left':0,'top':(Browser.Engine.trident4)?docScrollY:0,'width':'100%','height':(Browser.Engine.trident4)?docHeight:'100%'});}}}
esg.viewUtil.addPhotoPullerMonitorWindowEvents=function(){if(Browser.Engine.trident4){window.addEvents({'scroll':esg.viewUtil.keepPhotoPullerMonitorInView,'resize':esg.viewUtil.keepPhotoPullerMonitorInView});}}
esg.viewUtil.editorDialog={show:function(params){var id=params.id;var cssId=id+'_dialog'
var cssEditId=id+'_edit';var title=params.title;var callback=params.callback;var defaultValue=params.text;var dlg=null;if(!$(cssId)){dlg=new Element('div',{'class':'editDialog dialogbox','id':cssId});$('principal').appendChild(dlg);}else{dlg=$(cssId);dlg.innerHTML='';}
var header=new Element('div',{'class':'header'});var headerText=new Element('h3',{'html':title});var headerClose=new Element('a',{'id':'editGroupDialogClose','href':'javascript:void(0);','title':'Close','class':'dialogclose','events':{'click':function(e){e.stop();esg.viewUtil.editorDialog.hide(id)}}});header.appendChild(headerText);header.appendChild(headerClose);var topLeft=new Element('div',{'class':'dialogtopleft'});var topRight=new Element('div',{'class':'dialogtopright clearfix'});var dTopLeft=new Element('div',{'class':'dpaneltopleft'});var dTopRight=new Element('div',{'class':'dpaneltopright clearfix'});topRight.appendChild(header)
var input=new Element('input',{'type':'text','name':cssEditId,'id':cssEditId,'value':esg.utility.decodeHTML(defaultValue),'style':'color: #000;','events':{'select':function(event){if(!Browser.Engine.trident)
esg.utility.eraseField(this,event);},'focus':function(event){esg.utility.eraseField(this,event);},'blur':function(event){esg.utility.populateField(this,defaultValue,event);},'keydown':function(event){esg.utility.eraseField(this,event);},'keyup':function(event){if(event.key=='enter'&&!$(id+'_yes').hasClass('disabledbutton')){eval(callback);esg.viewUtil.editorDialog.hide(id);event.stop();}
esg.viewUtil.editorDialog.changeText(id,defaultValue);esg.utility.populateField(this,defaultValue,event);},'mousedown':function(event){esg.utility.eraseField(this,event);},'mouseup':function(event){esg.utility.eraseField(this,event);},'contextmenu':function(event){esg.utility.eraseField(this,event);}}});dTopRight.appendChild(input);dTopLeft.appendChild(dTopRight);topRight.appendChild(dTopLeft);var dBotLeft=new Element('div',{'class':'dpanelbotleft'});var dBotRight=new Element('div',{'class':'dpanelbotright'});dBotRight.appendChild(dBotLeft);topRight.appendChild(dBotRight);var footer=new Element('div',{'class':'changeGroupNameFooter clearfix'});var cancel=new Element('a',{'id':id+'_no','href':'javascript:void(0)','class':'editDialogNo linkbutton tertiarybutton','events':{'click':function(e){e.stop();esg.viewUtil.editorDialog.hide(id);}},'html':'<span>Cancel</span>'});var send=new Element('a',{'id':id+'_yes','href':'javascript:void(0)','class':' editDialogYes linkbutton disabledbutton','events':{'click':function(e){e.stop();if(!this.hasClass('disabledbutton')){eval(callback)
esg.viewUtil.editorDialog.hide(id);}}},'html':'<span>Save</span>'});footer.appendChild(send);footer.appendChild(cancel);topRight.appendChild(footer)
topLeft.appendChild(topRight);var botLeft=new Element('div',{'class':'dialogbotleft'});var botRight=new Element('div',{'class':'dialogbotright'});botRight.appendChild(botLeft);dlg.appendChild(topLeft);dlg.appendChild(botRight);if(Browser.Engine.trident4){dlg.setStyle('top',$(document.body).getScroll().y+$(document.body).getSize().y/2-dlg.getSize().y);}
esg.viewUtil.modalBox.show(cssId);$(cssEditId).focus();$(cssEditId).select();},hide:function(id){esg.viewUtil.modalBox.hide(id+'_dialog')},changeText:function(id,defaultText){var cssId=id+'_edit';var newName=$(cssId).value.trim();var button=$(id+'_yes');if((!newName||newName==defaultText)&&!button.hasClass('disabledbutton')){button.addClass('disabledbutton');return;}
if(button.hasClass('disabledbutton')&&$(cssId).value!=defaultText)
button.removeClass('disabledbutton')}}
if(!esg)var esg={};if(!esg.photoBook)esg.photoBook={};if(!esg.model)esg.model={};esg.photoBook.model={categories:{},selectedRootCategory:{},selectedCategory:{},selectedCoverDesign:{},defaultRootCategoryId:'Books',startIndex:9,totalWidth:884,defaultWidth:294,showRolloverTimer:-1,scrollTimer:-1,last:-1,animationActive:false,animationOptions:{duration:400,transition:Fx.Transitions.Cubic.easeOut},defaultPadding:{small:74,smallExpand:32,smallCollapse:8,medium:34,mediumLarge:13,large:34},config:{uris:{}},initialize:function(){this.categories=new PhotobookCategories();this.category=new PhotobookCategory();this.categories.categoryId=(esg.utility.getParameter('categoryId'))?esg.utility.getParameter('categoryId'):this.defaultRootCategoryId;}}
var PhotobookCategories=function(categoryId,entries,callBack){this.categoryId=(categoryId)?categoryId:'';this.entries=(entries)?entries:[];this.callBack=callBack;this.getCategoryBySize=function(size){if(size.length>1)
size=size.substring(0,1).toLowerCase();var ret=null;this.entries.each(function(category){if(ret)
return;if(category.size==size)
ret=category;});return ret;};this.getChildCategoryById=function(categoryId){var found=null;this.entries.each(function(category){if(category.childCategories.entries.length>0){category.childCategories.entries.each(function(childCategory){if(found)
return;if(childCategory.categoryId==categoryId)
found=childCategory;});}});return found;};this.moveToFront=function(cssId){this.sort();var idx=this.getIndexById(cssId);if(!idx)
return;var curIndex=0;var index=idx.index;var books=this.entries[idx.categoryIndex].childCategories;for(var i=0;i<books.entries.length;i++){if(i!=index){if(i<index)
books.entries[i].order=i+1;else
books.entries[i].order=i;}
else
books.entries[i].order=0;}
this.sort(idx.categoryIndex);};this.sort=function(categoryIndex){if(!categoryIndex){this.entries.each(function(category){category.childCategories.entries.sort(function(a,b){return a.order-b.order;});});}
else{this.entries[categoryIndex].childCategories.entries.sort(function(a,b){return a.order-b.order;});}};this.revertOrder=function(){this.entries.each(function(category){category.childCategories.entries.each(function(e){e.order=e.originalOrder;});});this.sort();};this.getChildCategoryById=function(cssId){var ret=null;this.entries.each(function(category){category.childCategories.entries.each(function(e){if(e.cssId==cssId){ret=e;return;}});});return ret;};this.getIndexById=function(cssId){var index=-1;var categoryIndex=-1;var found=false;this.entries.each(function(category){if(found)
return;categoryIndex++;index=-1;category.childCategories.entries.each(function(e){if(found)
return;index++;if(e.cssId==cssId){found=true
return;}});});return(found)?{index:index,categoryIndex:categoryIndex}:null;};};var PhotobookCategory=function(categoryId,name,iconImageURL,startingPrice,saleStartingPrice,childCategories,coverDesigns,callBack){this.categoryId=(categoryId)?categoryId:'';this.name=(name)?name:'';this.iconImageURL=(iconImageURL)?iconImageURL:'';this.startingPrice=(startingPrice)?startingPrice:'';this.saleStartingPrice=(saleStartingPrice)?saleStartingPrice:'';this.childCategories=(childCategories)?childCategories:new PhotobookCategories();this.callBack=callBack;this.coverDesigns=(coverDesigns)?coverDesigns:[];this.designsPopulated=(coverDesigns)?true:false;this.selectedCoverDesignIndex={category:0,design:0};this.parentCategory=null;this.size='';this.displayCategory=false;this.cssId='';this.order=0;this.originalOrder=0;this.step={x:-1,y:-1,minWidth:-1,maxWidth:-1,collapseX:-1,expandX:0,count:0,overlay:{w:-1,h:-1,x:-1,y:-1},selected:false,expanded:false};this.getSelectedCoverDesign=function(){return this.childCategories.entries[this.selectedCoverDesignIndex.category].coverDesigns[this.selectedCoverDesignIndex.design];}
this.getSelectedCoverDesignElement=function(){return $('coverStyle'+this.selectedCoverDesignIndex.category+'_'+this.selectedCoverDesignIndex.design);}
this.getCoverDesign=function(location){return this.childCategories.entries[location.category].coverDesigns[location.design];}
this.setStep=function(which){switch(which){case's':case'Small':this.step.x=20;this.step.y=-15;this.step.minWidth=140;this.step.maxWidth=240;this.step.collapseX=25;this.step.expandX=130;this.step.count=0;this.step.overlay.w=128;this.step.overlay.h=186;this.step.overlay.x=-11;this.step.overlay.y=-16;break;case'm':case'Medium':this.step.x=30;this.step.y=-20;this.step.minWidth=240;this.step.maxWidth=501;this.step.collapseX=40;this.step.expandX=168;this.step.count=0;this.step.overlay.w=168;this.step.overlay.h=251;this.step.overlay.x=-12;this.step.overlay.y=-15;break;case'l':case'Large':this.step.x=40;this.step.y=-25;this.step.minWidth=242;this.step.collapseX=30;this.step.expandX=230;this.step.count=0;this.step.overlay.w=220;this.step.overlay.h=258;this.step.overlay.x=-12;this.step.overlay.y=-12;break;}};this.callBack=callBack;};var PhotobookCoverDesign=function(productId,skuId,name,coverInvId,formFactorId,minimumPages,description,smallSwatchImageURL,mediumSwatchImageURL,mediumCoverImageURL,largeCoverImageURL,basePrice,salePrice,additionalPagePrice,callBack){this.productId=(productId)?productId:'';this.skuId=(skuId)?skuId:'';this.name=(name)?name:'';this.coverInvId=(coverInvId)?coverInvId:'';this.formFactorId=(formFactorId)?formFactorId:'';this.minimumPages=(minimumPages)?minimumPages:0;this.description=(description)?description:'';this.smallSwatchImageURL=(smallSwatchImageURL)?smallSwatchImageURL:'';this.mediumSwatchImageURL=(mediumSwatchImageURL)?mediumSwatchImageURL:'';this.mediumCoverImageURL=(mediumCoverImageURL)?mediumCoverImageURL:'';this.largeCoverImageURL=(largeCoverImageURL)?largeCoverImageURL:'';this.basePrice=(basePrice)?basePrice:'';this.salePrice=(salePrice)?salePrice:'';this.additionalPagePrice=(additionalPagePrice)?additionalPagePrice:'';this.designListHTML='';this.callBack=callBack;};(function(){var model=esg.photoBook.model;model.initialize();esg.model.observable.mixin(model);})();if(!esg)var esg={};if(!esg.photoBook)esg.photoBook={};esg.photoBook.commands={model:esg.photoBook.model,views:esg.photoBook.views,controller:esg.photoBook.controller,initialize:function(){this.sharedInitialize();},getCategoryProducts:function(onCompleteControllerEvent){var model=this.model;var controller=this.controller;var cmd=this;var url=model.config.uris.bookCategoryProducts;url=url.replace('{categoryId}',model.selectedCategory.categoryId);esg.viewUtil.throbber.show();var req=new esg.utility.JSONRequest({url:url,secure:false,method:"get",controller:controller,onSuccess:function(json){var rootCategory=model.categories.getChildCategoryById(model.selectedCategory.cssId);if(!rootCategory)
return false;var childCategories=new PhotobookCategories();if($defined(json.Category)){if($type(json.Category)!="array")
json.Category=[json.Category];json.Category.each(function(category,index){var coverDesigns=[];if($defined(category.CoverDesign)){if($type(category.CoverDesign)!="array")
category.CoverDesign=[category.CoverDesign];category.CoverDesign.each(function(coverDesign,index){var newCoverDesign=new PhotobookCoverDesign(coverDesign.productId,coverDesign.skuId,coverDesign.name,coverDesign.coverInvId,coverDesign.ffInvId,coverDesign.minimumPages,coverDesign.description,coverDesign.smallSwatchImageURL,coverDesign.mediumSwatchImageURL,coverDesign.mediumCoverImageURL,coverDesign.largeCoverImageURL,coverDesign.basePrice,coverDesign.salePrice,coverDesign.additionalPagePrice);coverDesigns.push(newCoverDesign);});}
var newCategory=new PhotobookCategory(category.categoryId,category.name,category.iconImageURL,category.startingPrice,category.salteStartingPrice,null,coverDesigns);childCategories.entries.push(newCategory);});rootCategory.childCategories=childCategories;rootCategory.designsPopulated=true;}
model.selectedCategory=rootCategory;if(onCompleteControllerEvent)
esg.photoBook.controller.execute(onCompleteControllerEvent);esg.viewUtil.throbber.hide();}}).send();},getCategoryProductsComplete:function(){},getCategories:function(onCompleteControllerEvent){var model=this.model;var controller=this.controller;var cmd=this;var url=model.config.uris.bookCategories;url=url.replace('{categoryId}',model.categories.categoryId);esg.viewUtil.throbber.show();var req=new esg.utility.JSONRequest({url:url,secure:false,method:"get",controller:controller,onSuccess:function(json){var categories=[];if($defined(json.Category)){if($type(json.Category)!="array")
json.Category=[json.Category];json.Category.each(function(category,index){var childCategories=new PhotobookCategories();if($defined(category.ChildCategories)){if($type(category.ChildCategories)!="array")
category.ChildCategories=[category.ChildCategories];category.ChildCategories.each(function(childCategory,subIndex){var newChildCategory=new PhotobookCategory(childCategory.categoryId,childCategory.name,childCategory.iconImageURL,childCategory.startingPrice,childCategory.saleStartingPrice);newChildCategory.displayCategory=false;newChildCategory.order=subIndex+1;newChildCategory.originalOrder=subIndex+1;newChildCategory.cssId='book'+esg.photoBook.commands.getSizeStringFromIndex(index,false)+(parseInt(subIndex)+1);newChildCategory.setStep(esg.photoBook.commands.getSizeStringFromIndex(index,true));childCategories.entries.push(newChildCategory);});}
var newCategory=new PhotobookCategory(category.categoryId,category.name,category.iconImageURL,category.startingPrice,category.saleStartingPrice,childCategories)
childCategories.entries.each(function(c){c.parentCategory=newCategory;});categories.push(newCategory);});model.categories.entries=categories;}
if(onCompleteControllerEvent)
esg.photoBook.controller.execute(onCompleteControllerEvent);esg.viewUtil.throbber.hide();}}).send();},getCategoriesComplete:function(){},getSizeStringFromIndex:function(index,abbreviate){switch(index){case 0:case's':case'Small':return(abbreviate)?'s':'Small';case 1:case'm':case'Medium':return(abbreviate)?'m':"Medium";case 2:case'l':case'Large':return(abbreviate)?'l':"Large";}},selectCategory:function(elem){var id=elem.id;var category=this.model.categories.getChildCategoryById(id);this.model.selectedCategory=category;if(!category.designsPopulated)
this.getCategoryProducts('selectCategory2');else
esg.photoBook.controller.execute('selectCategory2');},selectCoverDesign:function(elem){this.model.selectedCategory.selectedCoverDesignIndex=elem.retrieve('location');},selectPageDesigns:function(){var coverDesign=this.model.selectedCategory.getSelectedCoverDesign();var rootCategory=this.model.selectedRootCategory;var url='/gallery/templates/books/book_detail.jsp?skuId={skuId}&productId={productId}&catId={catId}';url=url.replace('{skuId}',coverDesign.skuId);url=url.replace('{productId}',coverDesign.productId.replace(/ /g,'_'));url=url.replace('{catId}',rootCategory.categoryId.replace(/ /g,'_'));if(!Browser.Engine.trident4)
document.location.href=url;else
(function(){window.location=url}).delay(1);return false;},showCoverDesignPreview:function(){var coverDesign=this.model.selectedCategory.getSelectedCoverDesign();if(coverDesign.designListHTML){esg.photoBook.controller.execute('showCoverDesignPreview2');return;}
var tmpImg=new Image();tmpImg.src=coverDesign.largeCoverImageURL;esg.viewUtil.throbber.show();var url=this.model.config.uris.pageDesignList;url=url.replace('{skuId}',coverDesign.skuId);var pageRqst=new Request.HTML({url:url,method:"GET",onSuccess:function(){coverDesign.designListHTML=pageRqst.response.text;esg.photoBook.controller.execute('showCoverDesignPreview2');esg.viewUtil.throbber.hide();}});pageRqst.setHeader('Content-Type','text/html');pageRqst.send();}}
if(!esg)
var esg={};if(!esg.photoBook)
esg.photoBook={};if(!esg.views)
esg.views={};esg.photoBook.views={initialize:function(){}};esg.photoBook.views.topNavigation={model:esg.photoBook.model,commands:esg.photoBook.commands,render:function(){var model=this.model;var small=$$('#navigationSmall .inner')[0];var med=$$('#navigationMedium .inner')[0];var lrg=$$('#navigationLarge .inner')[0];small.set('html','');med.set('html','');lrg.set('html','');var smallHeader=$('navigationSmallHeader');var smallSalePrice=$('navigationSmallSalePrice');var smallStartPrice=$('navigationSmallPrice');var mediumHeader=$('navigationMediumHeader');var mediumStartPrice=$('navigationMediumPrice');var mediumSalePrice=$('navigationMediumSalePrice');var largeHeader=$('navigationLargeHeader');var largeStartPrice=$('navigationLargePrice');var largeSalePrice=$('navigationLargeSalePrice');$('navigationSmall').addEvent('mouseover',function(){esg.photoBook.controller.execute('expandTopBarCategory',{size:'s'});});$('navigationMedium').addEvent('mouseover',function(){esg.photoBook.controller.execute('expandTopBarCategory',{size:'m'});});$('navigationLarge').addEvent('mouseover',function(){esg.photoBook.controller.execute('expandTopBarCategory',{size:'l'});});$('designWrapper').addEvent('mouseenter',function(){if(esg.photoBook.model.selectedCategory.parentCategory.name!=esg.photoBook.model.selectedRootCategory.name){esg.photoBook.controller.execute('expandTopBarCategory',{size:esg.photoBook.model.selectedCategory.parentCategory.size});}});model.categories.entries.each(function(category,index){var sizeText='';var sel={};switch(index){case 0:category.size='s';sizeText='Small';sel=small;smallSalePrice.set('html','$'+category.saleStartingPrice);smallStartPrice.set('html','<label>from: </label> $<span>'+category.startingPrice+'</span>');if(category.startingPrice>category.saleStartingPrice)
$('navigationSmall').addClass('onsale');break;case 1:category.size='m';sizeText='Medium';sel=med;mediumSalePrice.set('html','$'+category.saleStartingPrice);mediumStartPrice.set('html','<label>from: </label> $<span>'+category.startingPrice+'</span>');if(category.startingPrice>category.saleStartingPrice)
$('navigationMedium').addClass('onsale');break;case 2:category.size='l';sizeText='Large';sel=lrg;largeSalePrice.set('html','$'+category.saleStartingPrice);largeStartPrice.set('html','<label>from: </label> <span>$'+category.startingPrice+'</span>');if(category.startingPrice>category.saleStartingPrice)
$('navigationLarge').addClass('onsale');break;}
category.setStep(category.size);var cur={x:0,y:0,z:model.startIndex};category.childCategories.entries.each(function(book){var box=new Element('div');box.id=book.cssId;box.className='bookWrapper'+((book.startingPrice>book.saleStartingPrice)?' onsale':'');category.step.count++;box.style.left=cur.x+'px';box.style.top=cur.y+'px';cur.z-=3;box.style.zIndex=cur.z;cur.x+=category.step.x;cur.y+=category.step.y;var boxLabel=new Element('h4',{id:'bookLbl'+sizeText+category.step.count,html:esg.utility.decodeHTML(book.name),opacity:0});var boxSalePrice=new Element('div',{id:'bookSalePrice'+sizeText+category.step.count,html:'$'+book.saleStartingPrice});boxSalePrice.className='salePrice';var boxPrice=new Element('div',{id:'bookPrice'+sizeText+category.step.count,html:'<label>from:</label> <span>$'+book.startingPrice+'</span>',opacity:0});boxPrice.className='price';var boxImgWrapper=new Element('div');boxImgWrapper.className='imageWrapper';var boxImg=new Image();boxImg.src=book.iconImageURL;boxImg.id='bookImg'+sizeText+category.step.count;boxImgWrapper.appendChild(boxImg);box.addEvent('click',function(){esg.photoBook.controller.execute('selectCategory',{element:this})});box.addEvent('mouseover',function(){esg.photoBook.controller.execute('showTopBarRollover',{element:this})});box.addEvent('mouseout',function(){esg.photoBook.controller.execute('showTopBarRollover')});box.appendChild(boxLabel);box.appendChild(boxImgWrapper);box.appendChild(boxSalePrice);box.appendChild(boxPrice);sel.appendChild(box);});})
$('selectDesignsButton').addEvent('click',function(){esg.photoBook.controller.execute('selectPageDesigns');});$('quicklookdialogfade').addEvent('click',function(){esg.photoBook.controller.execute('hideCoverDesignPreview');});$('magnifyClose').addEvent('click',function(){esg.photoBook.controller.execute('hideCoverDesignPreview');});$('viewDetails').addEvent('click',function(){esg.photoBook.controller.execute('selectPageDesigns');});},show:function(elem,reset){var id=elem.id;var size=id.substring(4,5).toLowerCase();var fullSize=this.commands.getSizeStringFromIndex(size);var index=id.substring(id.length-1);var curStep=this.model.categories.getCategoryBySize(size).step;var small=this.model.categories.getCategoryBySize('s');var medium=this.model.categories.getCategoryBySize('m');var large=this.model.categories.getCategoryBySize('l');var smallStep=small.step;var mediumStep=medium.step;var largeStep=large.step;var isExpanded=curStep.expanded;var offset={};var callExpand=false;if(!isExpanded){(function(){esg.photoBook.views.topNavigation.show(elem,reset)}).delay(100);return;}
this.model.selectedCategory=this.model.categories.getChildCategoryById(id);if(smallStep.selected&&!smallStep.expanded&&!reset){var tmpLast=this.model.last;this.model.last='s';callExpand=true;}else if(mediumStep.selected&&!mediumStep.expanded&&!reset){var tmpLast=this.model.last;this.model.last='m';callExpand=true;}else if(largeStep.selected&&!largeStep.expanded&&!reset){var tmpLast=this.model.last;this.model.last='l';callExpand=true;}
smallStep.selected=mediumStep.selected=largeStep.selected=false;this.model.categories.revertOrder();if(callExpand){this.expand();this.model.last=tmpLast;}
var div='selectedBookOverlay';if($(div)){$(div).destroy()}
offset=curStep.overlay;curStep.selected=true;curStep.selectedIndex=index;$$('#navigation'+fullSize+' .inner')[0].appendChild(new Element('div',{id:div}));$$('.bookWrapper').each(function(e){if(e.hasClass('selected'))
e.removeClass('selected');});$(id).addClass('selected');this.model.categories.moveToFront(id);$(div).style.left=(($(id).style.left?parseInt($(id).style.left.replace('px','')):0)+offset.x)+'px';$(div).style.top=offset.y+'px';$(div).style.width=offset.w+'px';$(div).style.height=(offset.h-((Browser.Engine.trident&&size!='l')?11:0))+'px';esg.photoBook.views.topNavigation.revealBox(div);$(div).style.zIndex=(($(id).style.zIndex)?$(id).style.zIndex:50)-1;},showRollover:function(elem){var div='rolloverBookOverlay';if($(div)){$(div).destroy();}
if(!elem)
return;var id=elem.id;var size=id.substring(4,5).toLowerCase();var fullSize=this.commands.getSizeStringFromIndex(size);var index=id.substring(id.length-1);var curStep=this.model.categories.getCategoryBySize(size).step;var small=this.model.categories.getCategoryBySize('s');var medium=this.model.categories.getCategoryBySize('m');var large=this.model.categories.getCategoryBySize('l');var smallStep=small.step;var mediumStep=medium.step;var largeStep=large.step;if(this.model.showRolloverTimer!=-1){$clear(this.model.showRolloverTimer)
this.model.showRolloverTimer=-1;}
if(!curStep.expanded){this.model.showRolloverTimer=(function(){esg.photoBook.controller.execute('showTopBarRollover',{element:elem})}).delay(100);return;}
var offset={}
offset=curStep.overlay;$$('#navigation'+fullSize+' .inner')[0].appendChild(new Element('div',{id:div}));$(div).style.left=(($(id).style.left?parseInt($(id).style.left.replace('px','')):0)+offset.x)+'px';$(div).style.top=offset.y+'px';$(div).style.width=offset.w+'px';$(div).style.height=(offset.h-((Browser.Engine.trident&&size!='l')?11:0))+'px';esg.photoBook.views.topNavigation.revealBox(div);$(div).style.zIndex=(($(id).style.zIndex)?$(id).style.zIndex:50)-2;},expand:function(which){if(this.model.animationActive){var rolloverDiv='rolloverBookOverlay';if($(rolloverDiv)){$(rolloverDiv).destroy();}
$clear(this.model.animationActiveTimer);this.model.animationActiveTimer=(function(){esg.photoBook.views.topNavigation.expand(which)}).delay(50);return;}
var cur;if(which){this.model.selectedRootCategory=cur=this.model.categories.getCategoryBySize(which);}
var small=this.model.categories.getCategoryBySize('s');var medium=this.model.categories.getCategoryBySize('m');var large=this.model.categories.getCategoryBySize('l');var smallStep=small.step;var mediumStep=medium.step;var largeStep=large.step;var offset={};var callExpand=false;var opts=this.model.animationOptions;var last=this.model.last;var nS=new Fx.Morph('navigationSmall',opts);var nM=new Fx.Morph('navigationMedium',opts);var nL=new Fx.Morph('navigationLarge',opts);var chainCallCount=5;var wS,wM,wL;var chain=new Chain();var hideItems=[];var collapsing=false;if(last=='s'){var smallCur={x:0,y:0,z:this.model.startIndex};var funcs={};var curBooks=small.childCategories.entries;for(var i=0;i<curBooks.length;i++){var curId=curBooks[i].cssId;var oS=new Fx.Morph(curId,opts);funcs[i]=(function(f,x,z,y){return function(){f.start({left:x,zIndex:z,top:(!smallStep.selected)?y:0});if(!smallStep.selected){esg.photoBook.views.topNavigation.revealBox('navigationSmallPrice');esg.photoBook.views.topNavigation.revealBox('navigationSmallSalePrice');}
$('navigationSmall').removeClass('expanded');};})(oS,smallCur.x,smallCur.z,smallCur.y);chain.chain(funcs[i]);chainCallCount++;smallCur.x+=(smallStep.selected)?smallStep.collapseX:smallStep.x;smallCur.y+=smallStep.y;smallCur.z-=3;}
hideItems=$$('#navigationSmall .inner h4');hideItems.extend($$('#navigationSmall .inner .price'));collapsing=smallStep.selected;}
else
if(last=='m'){var mediumCur={x:0,y:0,z:this.model.startIndex};var funcs={};var curBooks=medium.childCategories.entries;for(var i=0;i<curBooks.length;i++){var curId=curBooks[i].cssId;var oS=new Fx.Morph(curId,opts);funcs[i]=(function(f,x,z,y){return function(){f.start({left:x,zIndex:z,top:(!mediumStep.selected)?y:0});if(!mediumStep.selected){esg.photoBook.views.topNavigation.revealBox('navigationMediumPrice');esg.photoBook.views.topNavigation.revealBox('navigationMediumSalePrice');}
$('navigationMedium').removeClass('expanded');};})(oS,mediumCur.x,mediumCur.z,mediumCur.y);chain.chain(funcs[i]);chainCallCount++;mediumCur.x+=(mediumStep.selected)?mediumStep.collapseX:mediumStep.x;mediumCur.y+=mediumStep.y;mediumCur.z-=3;}
hideItems=$$('#navigationMedium .inner h4');hideItems.extend($$('#navigationMedium .inner .price'));collapsing=mediumStep.selected;}
else
if(last=='l'){var largeCur={x:0,y:0,z:this.model.startIndex};var funcs={};var curBooks=large.childCategories.entries;for(var i=0;i<curBooks.length;i++){var curId=curBooks[i].cssId;var oS=new Fx.Morph(curId,opts);funcs[i]=(function(f,x,z,y){return function(){f.start({left:x,zIndex:z,top:(!largeStep.selected)?y:0});if(!largeStep.selected){esg.photoBook.views.topNavigation.revealBox('navigationLargeSalePrice');esg.photoBook.views.topNavigation.revealBox('navigationLargePrice');}
$('navigationLarge').removeClass('expanded');};})(oS,largeCur.x,largeCur.z,largeCur.y);chain.chain(funcs[i]);chainCallCount++;largeCur.x+=(largeStep.selected)?largeStep.collapseX:largeStep.x;largeCur.y+=largeStep.y;largeCur.z-=3;}
hideItems=$$('#navigationLarge .inner h4');hideItems.extend($$('#navigationLarge .inner .price'));collapsing=largeStep.selected;}
if(which&&which!=this.model.last){smallStep.expanded=mediumStep.expanded=largeStep.expanded=false;}
if(!which){if(!collapsing){hideItems.each(function(e){e.fade('hide');});}
chainCallCount-=4;for(var i=0;i<chainCallCount;i++)
chain.callChain();return;}
if(which==this.model.last)
return;var hf=function(){hideItems.each(function(e){if(e.parentNode.hasClass('selected'))
return;e.fade('hide');});}
hf.delay(esg.photoBook.model.animationOptions.duration);hf.delay(esg.photoBook.model.animationOptions.duration*2);chain.chain(hf);this.model.categories.revertOrder();if(which=='s'){wS=this.model.defaultWidth;wM=this.model.defaultWidth;wL=this.model.defaultWidth;var curX=0;var funcs={};var curBooks=small.childCategories.entries;for(var i=0;i<curBooks.length;i++){var curId=curBooks[i].cssId;var oS=new Fx.Morph(curId,opts);funcs[i]=(function(f,curX){return function(){f.start({left:curX,top:0});esg.photoBook.views.topNavigation.hideBox('navigationSmallPrice');esg.photoBook.views.topNavigation.hideBox('navigationSmallSalePrice');};})(oS,curX);curX+=smallStep.expandX;chain.chain(funcs[i]);chainCallCount++;}
funcs[++i]=function(){var oS=new Fx.Morph($$('#navigationSmall  .inner')[0],opts);oS.start({marginLeft:esg.photoBook.model.defaultPadding.smallExpand},opts);}
chain.chain(funcs[i]);chainCallCount++;funcs[++i]=function(){var oS=new Fx.Morph($$('#navigationMedium  .inner')[0],opts);oS.start({marginLeft:esg.photoBook.model.defaultPadding.medium},opts);}
chain.chain(funcs[i]);chainCallCount++;funcs[++i]=function(){var oS=new Fx.Morph($$('#navigationLarge  .inner')[0],opts);oS.start({marginLeft:esg.photoBook.model.defaultPadding.large},opts);}
chain.chain(funcs[i]);chainCallCount++;}
else
if(which=='m'){wS=smallStep.minWidth;wM=this.model.totalWidth-smallStep.minWidth-largeStep.minWidth;wL=largeStep.minWidth;var curX=0;var funcs={};var curBooks=medium.childCategories.entries;for(var i=0;i<curBooks.length;i++){var curId=curBooks[i].cssId;var oS=new Fx.Morph(curId,opts);funcs[i]=(function(f,curX){return function(){f.start({left:curX,top:0});esg.photoBook.views.topNavigation.hideBox('navigationMediumPrice');esg.photoBook.views.topNavigation.hideBox('navigationMediumSalePrice');};})(oS,curX);curX+=mediumStep.expandX;chain.chain(funcs[i]);chainCallCount++;}
funcs[++i]=function(){var oS=new Fx.Morph($$('#navigationSmall  .inner')[0],opts);oS.start({marginLeft:esg.photoBook.model.defaultPadding.smallCollapse},opts);}
chain.chain(funcs[i]);chainCallCount++;funcs[++i]=function(){var oS=new Fx.Morph($$('#navigationMedium  .inner')[0],opts);oS.start({marginLeft:0},opts);}
chain.chain(funcs[i]);chainCallCount++;funcs[++i]=function(){var oS=new Fx.Morph($$('#navigationLarge  .inner')[0],opts);oS.start({marginLeft:0},opts);}
chain.chain(funcs[i]);chainCallCount++;}
else
if(which=='l'){wS=smallStep.minWidth;wM=mediumStep.minWidth;wL=this.model.totalWidth-mediumStep.minWidth-smallStep.minWidth;var curX=0;var funcs={},funcs2={};var curBooks=large.childCategories.entries;for(var i=0;i<curBooks.length;i++){var curId=curBooks[i].cssId;var oS=new Fx.Morph(curId,opts);funcs[i]=(function(f,curX){return function(){f.start({left:curX,top:0});esg.photoBook.views.topNavigation.hideBox('navigationLargePrice');esg.photoBook.views.topNavigation.hideBox('navigationLargeSalePrice');};})(oS,curX);curX+=largeStep.expandX;chain.chain(funcs[i]);chainCallCount++;}
funcs[++i]=function(){var oS=new Fx.Morph($$('#navigationSmall  .inner')[0],opts);oS.start({marginLeft:esg.photoBook.model.defaultPadding.smallCollapse},opts);}
chain.chain(funcs[i]);chainCallCount++;funcs[++i]=function(){var oS=new Fx.Morph($$('#navigationMedium  .inner')[0],opts);oS.start({marginLeft:esg.photoBook.model.defaultPadding.mediumLarge},opts);}
chain.chain(funcs[i]);chainCallCount++;funcs[++i]=function(){var oS=new Fx.Morph($$('#navigationLarge  .inner')[0],opts);oS.start({marginLeft:esg.photoBook.model.defaultPadding.large},opts);}
chain.chain(funcs[i]);chainCallCount++;}
else{return;}
var a=function(){nS.start({width:wS})};var b=function(){nM.start({width:wM})};var c=function(){nL.start({width:wL})};chain.chain(a);chain.chain(b);chain.chain(c);if($('selectedBookOverlay')){var d;var selectedCategory=this.model.selectedCategory;if(selectedCategory.parentCategory.name==cur.name){var left=(selectedCategory.originalOrder-1)*selectedCategory.step.expandX+selectedCategory.step.overlay.x;d=function(){var selMorph=new Fx.Morph('selectedBookOverlay',opts);selMorph.start({left:left,zIndex:esg.photoBook.model.startIndex-1});};}
else{d=function(){var selMorph=new Fx.Morph('selectedBookOverlay',opts);selMorph.start({left:selectedCategory.step.overlay.x,zIndex:esg.photoBook.model.startIndex-1});};}
chain.chain(d);chainCallCount++;}
this.model.last=which;this.model.animationActive=true;var e=function(){(function(){var fadeInItems=[];switch(which){case's':smallStep.expanded=true;$('navigationSmall').addClass('expanded');fadeInItems=$$('#navigationSmall .inner h4');fadeInItems.extend($$('#navigationSmall .inner .price'));break;case'm':mediumStep.expanded=true;$('navigationMedium').addClass('expanded');fadeInItems=$$('#navigationMedium .inner h4');fadeInItems.extend($$('#navigationMedium .inner .price'));break;case'l':largeStep.expanded=true;$('navigationLarge').addClass('expanded');fadeInItems=$$('#navigationLarge .inner h4');fadeInItems.extend($$('#navigationLarge .inner .price'));break;}
esg.photoBook.model.animationActive=false;var chain2=new Chain();var funcsc2={};var chain2CallCount=0;var ops=esg.photoBook.model.fadeInAnimationOptions;for(var i=0;i<fadeInItems.length;i++){var curId=fadeInItems[i].id;funcsc2[i]=(function(f){f.set('tween',{duration:esg.photoBook.model.animationOptions.duration});f.fade('in');})($(curId));chain2.chain(funcsc2[i]);chain2CallCount++;}
for(var i=0;i<chain2CallCount;i++)
chain2.callChain();}).delay(opts.duration);}
chain.chain(e);for(var i=0;i<chainCallCount;i++)
chain.callChain();if(this.model.selectedCategory)
this.model.categories.moveToFront(this.model.selectedCategory.cssId);},hideBox:function(div){$(div).style.display='none';},revealBox:function(div,fadeIn){$(div).style.display='block';}}
esg.photoBook.views.bottom={model:esg.photoBook.model,commands:esg.photoBook.commands,render:function(){var rootCategory=this.model.selectedRootCategory;var category=this.model.selectedCategory;var designWrapper=$('designWrapper');var designTitle=$('designTitle');var designDescription=$('designDescription');var coverStyles=$('coverStyles');designTitle.set('html',esg.utility.decodeHTML(rootCategory.name)+': ');designDescription.set('html',esg.utility.decodeHTML(category.name));coverStyles.set('html','');var tmpImages=[];category.childCategories.entries.each(function(headerCategory,index1){var header=new Element('h4',{html:esg.utility.decodeHTML(headerCategory.name)});var styles=new Element('ul');headerCategory.coverDesigns.each(function(design,index2){var style=new Element('li');style.id='coverStyle'+index1+'_'+index2;var styleImg=new Image();styleImg.src=design.smallSwatchImageURL;style.store('location',{category:index1,design:index2});style.addEvent('mouseover',function(){esg.photoBook.controller.execute('showCoverDesignRollover',{element:this})});style.addEvent('click',function(){esg.photoBook.controller.execute('selectCoverDesign',{element:this})});style.appendChild(styleImg);styles.appendChild(style);tmpImages[tmpImages.length]=new Image();tmpImages[tmpImages.length-1].src=design.mediumSwatchImageURL;tmpImages[tmpImages.length]=new Image();tmpImages[tmpImages.length-1].src=design.mediumCoverImageURL;});coverStyles.appendChild(header);coverStyles.appendChild(styles);(function(){var sbHeight=Math.max($('coverStyle').getCoordinates().height,$('infoList').getCoordinates().height,$('designPreview').getCoordinates().height,260);$$('div.spacerBar').each(function(e){e.style.height=sbHeight+'px';});}).delay(500);});this.initializeCoverDesign();$('magnifyIcon').removeEvents();$('magnifyIcon').addEvent('click',function(){esg.photoBook.controller.execute('showCoverDesignPreview');});if(designWrapper.style.display!='block')
designWrapper.style.display='block';this.scrollView.delay(100);},scrollView:function(){if(window.getScroll().y>=$('navigationSmall').getTop()){return;}
var pos=Math.min($('navigationSmall').getTop(),window.getScroll().y+10)
window.scroll(0,pos);esg.photoBook.views.bottom.scrollView.delay(8);},initializeCoverDesign:function(){var category=this.model.selectedCategory;var elem=category.getSelectedCoverDesignElement();this.selectCoverDesign(elem);},selectCoverDesign:function(elem){var coverDesign=this.model.selectedCategory.getSelectedCoverDesign();$$('#coverStyles ul li').each(function(e){if(e.hasClass('selected'))
e.removeClass('selected');})
elem.addClass('selected');var designPreview=$('designPreview');var previewImage=$('previewImage');var coverStyleName=$('coverStyleName');var infoList=$('infoList');var infoSaleCost=$('infoSaleCost');var infoCost=$('infoCost');var infoPages=$('infoPages');var infoCostExtra=$('infoCostExtra');previewImage.src=coverDesign.mediumCoverImageURL;coverStyleName.set('html','Cover: '+esg.utility.decodeHTML(coverDesign.name));infoList.innerHTML=esg.utility.decodeHTML(coverDesign.description);infoSaleCost.set('html','$'+coverDesign.salePrice);infoCost.set('html','$'+coverDesign.basePrice);infoPages.set('html','('+coverDesign.minimumPages+' pgs)');if(coverDesign.salePrice<coverDesign.basePrice){designPreview.addClass('sale');}else if(designPreview.hasClass('sale')){designPreview.removeClass('sale');}
var additionalPagePrice=coverDesign.additionalPagePrice;if(!additionalPagePrice)
additionalPagePrice='0.99';infoCostExtra.set('html','extra pages $'+additionalPagePrice+' each');this.showCoverDesignRollover(elem,true);},showCoverDesignPreview:function(){},showCoverDesignRollover:function(element,hide){var id=element.id;var coverDesign=this.model.selectedCategory.getCoverDesign(element.retrieve('location'));var selectedCoverDesign=this.model.selectedCategory.getSelectedCoverDesign();var rollover=$('coverDesignRollover');var coords=element.getCoordinates();if(!hide){if(element.hasClass('selected'))
return;if(!rollover){rollover=new Image();rollover.id='coverDesignRollover';document.body.appendChild(rollover);rollover=$('coverDesignRollover');}
rollover.src=coverDesign.mediumSwatchImageURL;rollover.style.left=(coords.left-4)+'px';rollover.style.top=(coords.top-4)+'px';rollover.store('location',element.retrieve('location'));rollover.removeEvents();rollover.addEvent('mouseout',(function(e){return function(){esg.photoBook.controller.execute('showCoverDesignRollover',{element:e,hide:true});}})(element));rollover.addEvent('click',(function(e){return function(){esg.photoBook.controller.execute('selectCoverDesign',{element:e});}})(element));rollover.style.display='block';}else if(rollover){rollover.style.display='none';}},showCoverDesignPreview:function(){var coverDesign=this.model.selectedCategory.getSelectedCoverDesign();var category=this.model.selectedCategory;var sku=$('skuName');var formFactor=$('formFactorSize');var img=$('quickImg');var designs=$('idqviewpagedesigns');sku.set('html',esg.utility.decodeHTML(coverDesign.name));formFactor.set('html',esg.utility.decodeHTML(category.name));designs.set('html',coverDesign.designListHTML);img.src=coverDesign.largeCoverImageURL;if(typeof(window.scrollY)=='undefined'){if(document.documentElement.scrollTop==0){$('booksquicklookdialog').setStyle('top',100);}
else{$('booksquicklookdialog').setStyle('top',document.documentElement.scrollTop+20);}}
else{if(window.scrollY==0){$('booksquicklookdialog').setStyle('top',100);}
else{$('booksquicklookdialog').setStyle('top',window.scrollY+20);}}
$('booksquicklookdialog').style.display=$('quicklookdialogfade').style.display='block';},hideCoverDesignPreview:function(){$('booksquicklookdialog').style.display=$('quicklookdialogfade').style.display='none';}}
if(!esg)var esg={};if(!esg.photoBook)esg.photoBook={};esg.photoBook.controller={counter:0,execute:function(eventMsg,parms){var model=esg.photoBook.model;var cmd=esg.photoBook.commands;var views=esg.photoBook.views;switch(eventMsg){case'showTopNavigation':cmd.getCategories('showTopNavigationComplete');break;case'showTopNavigationComplete':cmd.getCategoriesComplete();views.topNavigation.render();break;case'getCategoryProducts':views.getCategoryProducts(parms.callBack?parms.callBack:"getCategoryProductsComplete")
case'getCategoryProductsComplete':break;case'expandTopBarCategory':if(!parms.size)
return;views.topNavigation.expand(parms.size);break;case'showTopBarCategory':if(!parms.element)
return;views.topNavigation.show(parms.element);break;case'selectCategory':if(!parms.element)
return;views.topNavigation.show(parms.element);cmd.selectCategory(parms.element);break;case'selectCategory2':views.bottom.render();break;case'showTopBarRollover':views.topNavigation.showRollover((parms&&parms.element)?parms.element:null);break;case'showCoverDesignRollover':if(!parms.element)
return;views.bottom.showCoverDesignRollover(parms.element,(parms.hide)?parms.hide:false);break;case'selectCoverDesign':if(!parms.element)
return;cmd.selectCoverDesign(parms.element);views.bottom.selectCoverDesign(parms.element);break;case'showCoverDesignPreview':cmd.showCoverDesignPreview();break;case'showCoverDesignPreview2':views.bottom.showCoverDesignPreview();break;case'hideCoverDesignPreview':views.bottom.hideCoverDesignPreview();break;case'selectPageDesigns':cmd.selectPageDesigns();break;case'getStarted':cmd.getStarted();break;default:console.error("Unknown command sent to Controller: Command: "+eventMsg+"   Parameters: "+JSON.encode(parms));break;}}}
function popup_simple(thisUrl)
{if(thisUrl=='printDetails'){thisUrl="/A/external/gallery/htmls/printDetails_popup.html";}
if(thisUrl=='printRetailers'){thisUrl="http://gallerystudio.custhelp.com/cgi-bin/gallerystudio.cfg/php/enduser/olh_adp.php?p_faqid=1039&p_olh=1";}
window.open(thisUrl,'thisUrl',"status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1,height=300,width=790");}
if($$('.pophelp')){$$('.pophelp').addEvents({'click':function(){popWin.open('http://gallerystudio.custhelp.com',800,600,'20');return false;}});}
if($$('.popfaq')){$$('.popfaq').addEvents({'click':function(){var fid=this.rel.replace(/[fid_]/g,"");popWin.open('http://gallerystudio.custhelp.com/cgi-bin/gallerystudio.cfg/php/enduser/olh_adp.php?p_faqid='+fid+'&p_olh=1',800,600,'center');return false;}});}