CorbisUI.ServiceManager.defineService("Checkout.CartScriptService.ValidateItems",{submissionTemplate:["productUids"]});CorbisUI.ServiceManager.defineService("Checkout.CartScriptService.UpdateCartItemPrice",{submissionTemplate:["productUid"]});CorbisUI.ServiceManager.defineService("Checkout.CartScriptService.AddItemsToCartContainer",{submissionTemplate:["cartProductUids","cartContainer"]});CorbisUI.ServiceManager.defineService("Checkout.CartScriptService.DeleteItemsFromCartContainer",{submissionTemplate:["cartProductUids","cartContainer"]});CorbisUI.ServiceManager.defineService("Checkout.CartScriptService.MoveItemWithInCart",{submissionTemplate:["cartProductUids","cartContainer"]});CorbisUI.ServiceManager.defineService("Checkout.CartScriptService.AddOfferingToCart",{submissionTemplate:["offeringUid"]});CorbisUI.ServiceManager.defineService("Checkout.CartScriptService.AddProductToCart",{submissionTemplate:["corbisId","productUid"]});CorbisUI.ServiceManager.defineService("Checkout.CartScriptService.GetPricedPricingDisplay",{submissionTemplate:["productUid"]});window.addEvent("domready",function(){CorbisUI.NameSpace.register("Corbis.Web.UI.Checkout.CartScriptService",{Alias:CorbisUI.ServiceManager.Checkout.CartScriptService,ForceAlias:true});});CorbisUI.ServiceManager.defineService("Picplan.SubscriptionScriptService.DownloadSubscriptionImages",{submissionTemplate:["projectName","fileSize","remainingCount","isContinue","isAdditionalPurchase"]});CorbisUI.NameSpace.register("CorbisUI.ServiceManager.Subscription",{Alias:CorbisUI.ServiceManager.Picplan});window.addEvent("domready",function(){CorbisUI.NameSpace.register("Corbis.Web.UI.Subscription",{Alias:CorbisUI.ServiceManager.Picplan});});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.UpdateLightboxProductNote",{submissionTemplate:["productUid","notedUid","noteText"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.GetLightboxCOFFImages",{submissionTemplate:["lightboxId","pageNumber","pageSize"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.GetMoveModifiedDate",{submissionTemplate:["lightboxId"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.GetLightboxCopyImages",{submissionTemplate:["lightboxId","pageNumber","pageSize"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.CopyLightboxImages",{submissionTemplate:["fromLightboxId","toLightboxId","imageUids","purgeItems"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.ValidateItemsForCOFF",{submissionTemplate:["fromLightboxId","imageUids"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.ContinueToCheckoutCOFFItems",{submissionTemplate:["fromLightboxId","coffOrderImages"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.GetLightBoxDropDownListForCopy",{submissionTemplate:["lightboxTreeSortBy"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.DeleteLightboxProductNote",{submissionTemplate:["productUid"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.SavePreviewPreference",{submissionTemplate:["previewState"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.GetLightBoxDropDownListForMove",{submissionTemplate:["lightboxIdToMove","lightboxTreeSortBy"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.MoveLightBox",{submissionTemplate:["lightboxIdToMove","newParentLightboxId"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.CreateLightbox",{submissionTemplate:["username","lighboxName"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.RenameLightbox",{submissionTemplate:["lightboxId","newLightboxName"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.UpdateSharedLightbox",{submissionTemplate:["lightboxId","lightboxName","clientName","noteUid","noteText"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.GetMemberAssociates");CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.AddMemberAssociate",{submissionTemplate:["associateUserName"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.CheckoutQuickPicImages",{submissionTemplate:["images"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.RemoveMemberAssociates",{submissionTemplate:["associateUserNames"]});CorbisUI.ServiceManager.defineService("Lightboxes.LightboxScriptService.TransferLightbox",{submissionTemplate:["lightboxId","associateUserNames","removeSource"]});window.addEvent("load",function(){CorbisUI.NameSpace.register("Corbis.Web.UI.Lightboxes",{Alias:CorbisUI.ServiceManager.Lightboxes,ForceAlias:true});});if(typeof(CorbisUI)=="undefined"){CorbisUI={};}CorbisUI.SearchConstructors={licenseMapping:["Unknown","RM","RF","RS"],pinkyBlockConstructor:new Class({closeButton:null,cartButton:false,quickCheckoutButton:false,mediaUID:null,corbisID:null,realProductUID:null,lightboxID:0,licenseModel:null,isOutline:false,isRfcd:false,injectWhere:null,block:null,isInCart:function(){return CorbisUI.cartMediaUidList.has(this.mediaUID);},highlightIcon:function(iconType){if(iconType=="cart"){this.block.addClass("inCart");}},createBlock:function(newItem,caller){var objRef,imageRef,imageClone,title,coords,clickLink;var coordsBase={marginTop:90,width:90,height:90};objRef=(newItem)?this.tempObject:CorbisUI.ProductCache.get(this.mediaUID);this.isOutline=(newItem)?this.tempObject.IsOutLine:CorbisUI.ProductCache.get(this.mediaUID).isOutline;this.isRfcd=(newItem)?this.tempObject.IsRfcd:CorbisUI.ProductCache.get(this.mediaUID).isRfcd;if(!newItem){objRef.setupObject();}this.injectWhere=(newItem)?"bottom":"top";var objRefLicenseModal=(newItem)?CorbisUI.SearchConstructors.licenseMapping[objRef.LicenseModel]:objRef.licenseModel;this.licenseModel=Corbis.CommonSchema.Contracts.V1.LicenseModel.toLocalizedString(Corbis.CommonSchema.Contracts.V1.LicenseModel[objRefLicenseModal]);var Wrap=new Element("div",{"class":this.constructorType+"Block",corbisid:this.corbisID});var closeWrap=new Element("div").addClass("hoverBtn").addClass("closeIcon").inject(Wrap);var closeInput=new Element("input").setProperties({"class":"hovable",value:"",title:CorbisUI.GlobalVars.SearchResults.text.deleteBtnAlt,alt:CorbisUI.GlobalVars.SearchResults.text.deleteBtnAlt}).addEvent("click",this.deleteButtonEvent.bindWithEvent(this)).inject(closeWrap);this.closeButton=closeInput;clickLink=function(){if(objRef.IsRfcd==true){window.location.href="/ImageGroup/"+Corbis.Legacy.Proxy.ImageService.V1.ImageMediaSetType.RFCD+"/"+findCorbisId(objRef);}else{CorbisUI.Utilities.openEnlargementPage("/stock-photo/"+findCorbisId(objRef));}};function findCorbisId(obj){if(!obj.CorbisId){if(obj.corbisID){if(typeof(obj.corbisID)=="string"){return obj.corbisID;}return obj.corbisID.getAttribute("corbisid");}else{if(obj.corbisId){if(typeof(obj.corbisId)=="string"){return obj.corbisId;}return obj.corbisId.getAttribute("corbisid");}}}return obj.CorbisId;}var thumbBlock=new Element("div").setProperties({"class":"thumbWrap"}).setStyles({cursor:"pointer",background:"#262626"});if(clickLink){thumbBlock.addEvent("click",clickLink);}thumbBlock.inject(Wrap);if(!newItem){imageRef=objRef.thumbWrap.getFirst("img");imageClone=imageRef.clone();coords=CorbisUI.SearchConstructors.helpers.ScaleImage2(objRef.thumbWrap.getFirst("img"),coordsBase);imageClone.setStyles(coords);if(imageClone.getProperty("onclick")){imageClone.removeProperty("onclick");}title=imageRef.getProperty("title");}else{this.realProductUID=objRef.ProductUid;imageClone=new Element("img",{src:objRef.Url128});if(objRef.AspectRatio<1){coords={width:90*objRef.AspectRatio,height:90};}else{coords={width:90,height:90/objRef.AspectRatio,marginTop:(90-(90/objRef.AspectRatio))/2};}imageClone.setStyles(coords);title=objRef.corbisId+" - "+objRef.Title;}imageClone.setProperties({title:title,alt:title});imageClone.inject(thumbBlock);this.licenseBlock=new Element("div").addClass(this.licenseModel+"color infoBox").inject(Wrap);var licenseWrap=new Element("div").addClass("license").inject(this.licenseBlock);var LT=new Element("span").set("text",this.licenseModel).inject(licenseWrap);this.block=Wrap;if(newItem){this.tempObject=null;}}}),helpers:{ScaleImage:function(ele,options){var Base={marginTop:90,width:90,height:90};if(options){Base=$merge(Base,options);}var OrigCoords=ele.getCoordinates();var Coords={width:0,height:0};Coords.width=OrigCoords.width;Coords.height=OrigCoords.height;var newValues=Base;for(var n in Coords){var m=Base[n];if(Coords[n]>m&&Base[n]){var o=(n=="width")?"height":"width";var r=m/Coords[n];newValues[n]=m;newValues[o]=Math.ceil(Base[o]*r);}}var wrap,img,m;if(newValues.height<=Base.marginTop){wrap=(Base.marginTop/2);img=(newValues.height/2);newValues.marginTop=(wrap-img);}if(Coords.height<options.marginTop){newValues.width=90;}return newValues;},ScaleImage2:function(ele,options){var Base={marginTop:90,width:90,height:90};if(options){Base=$merge(Base,options);}var OrigCoords=ele.getCoordinates();var Coords={width:0,height:0};Coords.width=OrigCoords.width;Coords.height=OrigCoords.height;var newValues=Base;if(Coords.height>Coords.width){newValues.width=newValues.width*(Coords.width/Coords.height);}else{newValues.height=newValues.height*(Coords.height/Coords.width);}var wrap,img,m;if(newValues.height<=Base.marginTop){wrap=(Base.marginTop/2);img=(newValues.height/2);newValues.marginTop=(wrap-img);}if(Coords.height<options.marginTop){newValues.width=90;}newValues.width=newValues.width.round();newValues.height=newValues.height.round();newValues.marginTop=newValues.marginTop.round();return newValues;}}};if(typeof(CorbisUI)=="undefined"){CorbisUI={};}CorbisUI.SearchModels={ProductBlock:new Class({Implements:[Options,Events],productBlock:null,LB:null,QP:null,CT:null,SB:null,activeStates:{LB:false,QP:false,CT:false,SB:false},subscriptionImage:false,licenseModel:null,productUID:null,corbisID:null,isSelected:false,isOutline:false,QPenabled:false,SBenabled:false,CTenabled:false,basketCase:false,refreshPage:false,thumbWrap:null,isSetup:false,initialize:function(el){if(!el){return false;}this.productBlock=$(el);this.isSetup=false;var properties=this.productBlock.getProperties("licensemodel","productuid","corbisid","isoutline","subscription");this.licenseModel=properties.licensemodel;this.productUID=properties.productuid;this.corbisID=properties.corbisid;this.isOutline=properties.isoutline||false;if(properties.subscription=="true"){this.subscriptionImage=true;}CorbisUI.ProductCache.addObject(this.productUID,this);CorbisUI.ProductCache.addObject(this.corbisID,this.productUID);if(CorbisUI.cartMediaUidList.has(this.productUID)){this.updateIcon("CT","selectIcon");}if(Browser.Engine.trident){return false;}else{this.productBlock.getElement("div.LT").addEvent("click",this.test.bindWithEvent(this));}},setupObject:function(){if(!this.isSetup){this.thumbWrap=this.productBlock.getElement(".thumbWrap");this.isSelected=this.productBlock.hasClass("ProductSelected");this.QPenabled=(this.productBlock.getElement(".ICN_quickpic")==null)?false:true;this.SBenabled=(this.productBlock.getElement(".ICN_subscription")==null)?false:true;this.CTenabled=(this.productBlock.getElement("li[class^=ICN_cart]")==null)?false:true;this.LB=this.productBlock.getElement(".ICN_lightbox");this.activeStates.LB=(this.LB==null)?false:this.LB.hasClass("ICN_lightbox_selected");if(this.QPenabled){this.QP=this.productBlock.getElement(".ICN_quickpic");this.activeStates.QP=this.QP.hasClass("ICN_quickpic_selected");}if(this.SBenabled){this.SB=this.productBlock.getElement(".ICN_subscription");this.activeStates.SB=this.SB.hasClass("ICN_subscription_selected");}if(this.CTenabled){this.CT=this.productBlock.getElement("li[class^=ICN_cart]");this.basketCase=this.CT.hasClass("ICN_cartBasket");if(this.basketCase){this.activeStates.CT=this.CT.hasClass("ICN_cartBasket_selected");}else{this.activeStates.CT=this.CT.hasClass("ICN_cart_selected");}}if(this.SBenabled){this.SB=this.productBlock.getElement(".ICN_subscription");this.activeStates.SB=this.SB.hasClass("ICN_subscription_selected");}this.isSetup=true;}return this;},checkLightboxStatus:function(){var status=(this.isSetup)?this.activeStates.LB:this.productBlock.getElement(".ICN_lightbox").hasClass("ICN_lightbox_selected");return status;},test:function(event){this.setupObject();},updateIcon:function(type,action){this.setupObject();this[action](type);},selectIcon:function(type,priceDetails){switch(type){case"LB":if(!this.LB.hasClass("ICN_lightbox_selected")){this.LB.toggleClass("ICN_lightbox_selected");}var image=this.LB.getElement("img[id$=Img2]");if(image){image.setProperties({title:CorbisUI.GlobalVars.SearchResults.text.removeLightBoxAlt,alt:CorbisUI.GlobalVars.SearchResults.text.removeLightBoxAlt});}this.activeStates.LB=true;break;case"QP":if(this.QPenabled){if(!this.QP.hasClass("QP_on")){this.QP.addClass("QP_on");}if(this.QP.hasClass("QP_off")){this.QP.removeClass("QP_off");}if(!this.QP.hasClass("ICN_quickpic_selected")){this.QP.addClass("ICN_quickpic_selected");}var image=this.QP.getElement("img[id$=qpIcon]");if(image){image.setProperties({title:CorbisUI.GlobalVars.SearchResults.text.removeQuickpicAlt,alt:CorbisUI.GlobalVars.SearchResults.text.removeQuickpicAlt});}this.activeStates.QP=true;}break;case"SB":if(!this.SB.hasClass("ICN_subscription_selected")){this.SB.toggleClass("ICN_subscription_selected");}if(this.SBenabled){var image=this.SB.getElement("img[id$=sbIcon]");if(image){image.setProperties({title:CorbisUI.GlobalVars.SearchResults.text.removeSubscriptionAlt,alt:CorbisUI.GlobalVars.SearchResults.text.removeSubscriptionAlt});}}this.activeStates.SB=true;break;case"CT":if(this.CTenabled){if(this.basketCase){if(!this.CT.hasClass("ICN_cartBasket_selected")){this.CT.addClass("ICN_cartBasket_selected");}}else{if(!this.CT.hasClass("ICN_cart_selected")){this.CT.addClass("ICN_cart_selected");}}this.activeStates.CT=true;CorbisUI.cartMediaUidList.set(this.productUID,true);var image=this.CT.getElement("img[id$=addToCartImage]");if(image){image.setProperties({title:CorbisUI.GlobalVars.SearchResults.text.removeCartAlt,alt:CorbisUI.GlobalVars.SearchResults.text.removeCartAlt});}if(priceDetails&&priceDetails.price){var addToCartButton=this.CT.getParent().getElement("a[id$=priceImageLink]");if(addToCartButton){var self=this;var priceLinkHandler=null;var lightboxId=$(document.body).getElement("div.Lightbox div.Active").id;if(priceDetails.isContactUs){priceLinkHandler=function(){CorbisUI.RequestPricing.showModal(self.corbisID,lightboxId,"Lightbox",this.licenseModel);};}else{if(this.licenseModel=="RM"){priceLinkHandler=function(){PriceImage("../Pricing/SRMPricing.aspx?CorbisId="+self.corbisID+"&ProductUid="+self.productUID+"&ParentPage=Lightbox&LightboxId="+lightboxId,720,578);};}else{if(this.licenseModel=="RF"){priceLinkHandler=function(){PriceImage("../Pricing/RFPricing.aspx?CorbisId="+self.corbisID+"&ProductUid="+self.productUID+"&ParentPage=Lightbox&LightboxId="+lightboxId,640,573);};}}}addToCartButton.removeProperty("onclick");if(Browser.Engine.trident){addToCartButton.onclick=null;}addToCartButton.removeEvents();addToCartButton.addEvent("click",priceLinkHandler);var price=priceDetails.price.replace("(","").replace(")","");var productBlockNode=this.CT.getParent().getParent().getParent().getParent().getParent();var existingPrice=productBlockNode.getElement("span div.productPriceInfo div");if(existingPrice){existingPrice.set("html",price);existingPrice.removeProperty("onclick");existingPrice.removeEvents();existingPrice.addEvent("click",priceLinkHandler);var existingPriceStatus=productBlockNode.getElement("span div.productPriceInfo div.priceStatus");if(existingPriceStatus&&!priceDetails.priceStatusText){existingPriceStatus.dispose();}if(!existingPriceStatus&&priceDetails.priceStatusText){this.addPriceStatusToProductBlock(productBlockNode.getElement("span div.productPriceInfo"),priceDetails.priceStatusText);}}else{var priceNode=new Element("span");var priceInfoNode=new Element("div",{"class":"productPriceInfo hide-for-print"});var priceTextNode=new Element("div",{"class":"price",html:price,events:{click:priceLinkHandler}});priceNode.appendChild(priceInfoNode);priceInfoNode.appendChild(priceTextNode);productBlockNode.appendChild(priceNode);if(priceDetails.priceStatusText){this.addPriceStatusToProductBlock(priceInfoNode,priceDetails.priceStatusText);}}}}}break;}this.highlightBlock();},addPriceStatusToProductBlock:function(parentNode,priceStatusText){var priceStatusNode=new Element("div",{"class":"priceStatus",html:priceStatusText});parentNode.appendChild(priceStatusNode);},deselectIcon:function(type){switch(type){case"LB":if(this.LB.hasClass("ICN_lightbox_selected")){this.LB.toggleClass("ICN_lightbox_selected");}var image=this.LB.getElement("img[id$=Img2]");if(image){image.setProperties({title:CorbisUI.GlobalVars.SearchResults.text.addToLightBoxAlt,alt:CorbisUI.GlobalVars.SearchResults.text.addToLightBoxAlt});}this.activeStates.LB=false;break;case"QP":if(this.QPenabled){if(this.QP.hasClass("QP_on")){this.QP.removeClass("QP_on");}if(!this.QP.hasClass("QP_off")){this.QP.addClass("QP_off");}if(this.QP.hasClass("ICN_quickpic_selected")){this.QP.removeClass("ICN_quickpic_selected");}var image=this.QP.getElement("img[id$=qpIcon]");if(image){image.setProperties({title:CorbisUI.GlobalVars.SearchResults.text.addQuickpicAlt,alt:CorbisUI.GlobalVars.SearchResults.text.addQuickpicAlt});}this.activeStates.QP=false;}break;case"SB":if(this.SB.hasClass("ICN_subscription_selected")){this.SB.toggleClass("ICN_subscription_selected");}var image=this.SB.getElement("img[id$=sbIcon]");if(image){image.setProperties({title:CorbisUI.GlobalVars.SearchResults.text.addSubscriptionAlt,alt:CorbisUI.GlobalVars.SearchResults.text.addSubscriptionAlt});}this.activeStates.SB=false;break;case"CT":if(this.CTenabled){if(this.basketCase){if(this.CT.hasClass("ICN_cartBasket_selected")){this.CT.toggleClass("ICN_cartBasket_selected");}}else{if(this.CT.hasClass("ICN_cart_selected")){this.CT.toggleClass("ICN_cart_selected");}}var image=this.CT.getElement("img[id$=addToCartImage]");if(image){image.setProperties({title:CorbisUI.GlobalVars.SearchResults.text.addToCartAlt,alt:CorbisUI.GlobalVars.SearchResults.text.addToCartAlt});}this.activeStates.CT=false;}break;}this.unhighlightBlock();},highlightBlock:function(){if(this.activeStates.LB||(this.QPenabled&&this.activeStates.QP)||(this.SBenabled&&this.activeStates.SB)||(this.CTenabled&&this.activeStates.CT)){if($(document.body).getElement("div.thumbnailPlusDetails")!=null){if($(document.body).getElement("div.thumbnailPlusDetails").getStyle("background-position")=="0% 0%"){var product=(window.location.href.toLowerCase().contains("mylightboxes.aspx"))?this.productBlock:this.productBlock.getParent();if(!product.hasClass("ProductSelected")){product.toggleClass("ProductSelected");}}else{if(!this.productBlock.hasClass("ProductSelected")){this.productBlock.toggleClass("ProductSelected");}}}else{if(!this.productBlock.hasClass("ProductSelected")){this.productBlock.toggleClass("ProductSelected");}}}},unhighlightBlock:function(){if(!this.activeStates.LB&&!this.activeStates.QP&&!this.activeStates.SB&&!this.activeStates.CT){if($(document.body).getElement("div.thumbnailPlusDetails")!=null){if($(document.body).getElement("div.thumbnailPlusDetails").getStyle("background-position")=="0% 0%"){var product=(window.location.href.toLowerCase().contains("mylightboxes.aspx"))?this.productBlock:this.productBlock.getParent();if(product.hasClass("ProductSelected")){product.toggleClass("ProductSelected");}}else{if(this.productBlock.hasClass("ProductSelected")){this.productBlock.toggleClass("ProductSelected");}}}else{if(this.productBlock.hasClass("ProductSelected")){this.productBlock.toggleClass("ProductSelected");}}}},refreshObject:function(){var item=CorbisUI.DomCache.get("ProductResults").getElement("span[productuid="+this.productUID+"]");if(item){this.initialize(item);this.setupObject();}return this;}}),subscriptionBlock:new Class({Implements:[CorbisUI.SearchConstructors.pinkyBlockConstructor,Options,Events],constructorType:"subscription",options:{},tempObject:{},initialize:function(mediaUID,corbisID,options,realProductUid){if($type(mediaUID)=="object"){this.tempObject=mediaUID;this.mediaUID=this.tempObject.MediaUid;this.corbisID=this.tempObject.CorbisId;this.createBlock(true,"subcription");}else{if(options){this.setOptions(options);}this.mediaUID=mediaUID;this.corbisID=corbisID;this.realProductUID=realProductUid;this.createBlock(false,"subcription");}if(CorbisUI.ProductCache.has(this.mediaUID)){CorbisUI.ProductCache.get(this.mediaUID).updateIcon("SB","selectIcon");}CorbisUI.DomCache.get("subscriptionContainer",true).grab(this.block,this.injectWhere);},deleteButtonEvent:function(){CorbisUI.Handlers.Subscription.deleteItem(this.mediaUID);if(CorbisUI.ProductCache.has(this.mediaUID)){CorbisUI.ProductCache.get(this.mediaUID).updateIcon("SB","deselectIcon");}var imageCountProperty=CorbisUI.DomCache.get("subscriptionContainer").getProperty("imageCount");var imageCount=parseInt(imageCountProperty);if(!isNaN(imageCount)){imageCount-=1;}else{imageCount=CorbisUI.DomCache.get("subscriptionContainer").getElements("div.subscriptionBlock").length;}CorbisUI.DomCache.get("subscriptionContainer").setProperty("imageCount",imageCount.toString());document.body.getElement(".subscriptionCounts span.imageCount").set("text",imageCount.toString());this.block.destroy();if(CorbisUI.DomCache.get("subscriptionContainer").getElements("div.subscriptionBlock").length==0&&document.body.getElement("div.subscriptionCounts").getElement(".remainingCount").get("text")=="0"){if(CorbisUI.DomCache.get("subscriptionContainer").getElement(".centerMe")){CorbisUI.DomCache.get("subscriptionContainer").getElement(".centerMe").setStyle("display","none");}if(CorbisUI.DomCache.get("subscriptionContainer").getElement(".remainingZerocenterMe")){CorbisUI.DomCache.get("subscriptionContainer").getElement(".remainingZerocenterMe").setStyle("display","block");}}}}),lightboxBlock:new Class({Implements:[CorbisUI.SearchConstructors.pinkyBlockConstructor,Options,Events],constructorType:"lightbox",options:{},tempObject:{},subscriptionImage:false,initialize:function(mediaUID,corbisID,options,realProductUid){if($type(mediaUID)=="object"){this.tempObject=mediaUID;this.mediaUID=this.tempObject.MediaUid;this.corbisID=this.tempObject.CorbisId;this.subscriptionImage=this.tempObject.IsSubscription;this.createBlock(true,"lightbox");}else{if(options){this.setOptions(options);}this.mediaUID=mediaUID;this.corbisID=corbisID;this.realProductUID=realProductUid;this.subscriptionImage=CorbisUI.ProductCache.get(this.mediaUID).subscriptionImage;this.createBlock(false,"lightbox");}if(this.isInCart()){this.block.addClass("inCart");}if(isQuickCheckoutEnabled&&!this.isOutline&&!this.isRfcd&&!Browser.Engine.trident4){var expressIconType=CorbisUI.GlobalVars.SearchResults.isECommerceEnabled?(CorbisUI.GlobalVars.SearchResults.isBasket?"lightboxExpressBasket":"lightboxExpressCheckout"):"";var quickCheckoutAnchor=new Element("a").setProperties({alt:CorbisUI.GlobalVars.SearchResults.text.expressCheckoutAlt,title:CorbisUI.GlobalVars.SearchResults.text.expressCheckoutAlt}).addClass(CorbisUI.GlobalVars.SearchResults.isBasket?"lightboxExpressBasket":"lightboxExpressCheckout").addEvent("click",this.expressCheckoutButtonEvent.bindWithEvent(this)).inject(this.licenseBlock);this.quickCheckoutButton=quickCheckoutAnchor;}var cartIconType=CorbisUI.GlobalVars.SearchResults.isECommerceEnabled?(CorbisUI.GlobalVars.SearchResults.isBasket?"lightboxBasket":"lightboxCart"):"";var cartAnchor=new Element("a").addClass(cartIconType).addEvent("click",this.cartButtonEvent.bindWithEvent(this)).inject(this.licenseBlock);var altText;if(this.isInCart()){altText=CorbisUI.GlobalVars.SearchResults.text.removeCartAlt;cartAnchor.addClass("inCart");}else{altText=CorbisUI.GlobalVars.SearchResults.text.addToCartAlt;}cartAnchor.setProperties({alt:altText,title:altText});this.cartButton=cartAnchor;if(CorbisUI.ProductCache.has(this.mediaUID)){CorbisUI.ProductCache.get(this.mediaUID).updateIcon("LB","selectIcon");}CorbisUI.DomCache.get("LBXContainer",true).grab(this.block,this.injectWhere);},deleteButtonEvent:function(){var lightboxId=CorbisUI.DomCache.get("SBBX_lightboxes").getElement("select.lightboxList").getSelected()[0].value;Corbis.Web.UI.SearchOld.SearchScriptService.DeleteProductFromLightbox(lightboxId,this.realProductUID);if(CorbisUI.ProductCache.has(this.mediaUID)){CorbisUI.ProductCache.get(this.mediaUID).updateIcon("LB","deselectIcon");}var imageCountProperty=CorbisUI.DomCache.get("LBXContainer").getProperty("imageCount");var imageCount=parseInt(imageCountProperty);if(!isNaN(imageCount)){imageCount-=1;}else{imageCount=CorbisUI.DomCache.get("LBXContainer").getElements("div.lightboxBlock").length;}CorbisUI.DomCache.get("LBXContainer").setProperty("imageCount",imageCount.toString());if(imageCount==0&&CorbisUI.DomCache.get("LBXContainer").getElement(".centerMe")!=null){CorbisUI.DomCache.get("LBXContainer").getElement(".centerMe").setStyle("display","block");}this.block.destroy();},cartButtonEvent:function(){if(!this.isInCart()){Corbis.Web.UI.SearchOld.SearchScriptService.AddProductToCart(this.mediaUID,this.realProductUID);var cartCounter=CorbisUI.DomCache.get("cartCount");if(cartCounter){var count=cartCounter.getProperty("text");count++;cartCounter.setProperty("text",count);fixIECheckoutWidgetWidth();}this.highlightIcon("cart");CorbisUI.cartMediaUidList.set(this.mediaUID,true);if(this.isInCart()){var anchorTagObj=this.block.getElement("a[class=lightboxCart]")?this.block.getElement("a[class=lightboxCart]"):this.block.getElement("a[class=lightboxBasket]");if(anchorTagObj){anchorTagObj.setProperties({title:CorbisUI.GlobalVars.SearchResults.text.removeCartAlt,alt:CorbisUI.GlobalVars.SearchResults.text.removeCartAlt});$(anchorTagObj).addClass("inCart");}}if(CorbisUI.ProductCache.has(this.mediaUID)){CorbisUI.ProductCache.get(this.mediaUID).updateIcon("CT","selectIcon");}}},expressCheckoutButtonEvent:function(){this.lightboxId=$(document.body).getElement("select[name$=lightboxList]").getSelected()[0].value;CorbisUI.ExpressCheckout.Open(this.corbisID,this.realProductUID,this.lightboxId);}}),quickPicBlock:new Class({Implements:[CorbisUI.SearchConstructors.pinkyBlockConstructor,Options,Events],constructorType:"quickPic",options:{},initialize:function(mediaUID,corbisID,options){if(options){this.setOptions(options);}if($type(mediaUID)=="object"){this.tempObject=mediaUID;this.mediaUID=this.tempObject.MediaUid;this.corbisID=this.tempObject.CorbisId;this.createBlock(true,"quickpic");}else{if(options){this.setOptions(options);}this.mediaUID=mediaUID;this.corbisID=corbisID;this.createBlock(false,"quickpic");}if(CorbisUI.ProductCache.has(this.mediaUID)){CorbisUI.ProductCache.get(this.mediaUID).updateIcon("QP","selectIcon");}var downloadAll=$("SBBX_quickpic").getElement("div[id$=downloadAll]");CorbisUI.DomCache.addObject("quickPicDownloadAll",downloadAll);var target=CorbisUI.DomCache.get("quickPicsContainer").getFirst();this.block.inject(target,this.injectWhere);},deleteButtonEvent:function(){CorbisUI.Handlers.Quickpic.deleteItem(this.corbisID);}})};if(typeof(CorbisUI)=="undefined"){CorbisUI={};}CorbisUI.Subscription={};CorbisUI.Subscription={result:null,DownloadSubscriptionImages:function(remainingCount,isContinue,isPurchase){var dropDown=$("SBBX_subscriptions").getElement("select.subscriptionFileSize");var FileSize=dropDown.options[dropDown.selectedIndex].value;if(isContinue==true){Corbis.Web.UI.Subscription.SubscriptionScriptService.DownloadSubscriptionImages($("SBBX_subscriptions").getElement("div.txtProjectName input").value,FileSize,remainingCount,isContinue,isPurchase,CorbisUI.Subscription.continueDownloadSuccess,CorbisUI.Subscription.DownloadImageFailed);}else{Corbis.Web.UI.Subscription.SubscriptionScriptService.DownloadSubscriptionImages($("SBBX_subscriptions").getElement("div.txtProjectName input").value,FileSize,remainingCount,isContinue,isPurchase,CorbisUI.Subscription.DownloadExceptionCheck,CorbisUI.Subscription.DownloadImageFailed);CorbisUI.Subscription.OpenProgressModal();}},DownloadExceptionCheck:function(result){HideModal("downloadProgress");if(result.Status==1){CorbisUI.Subscription.result=result;CorbisUI.Subscription.emptySubscriptionBuddy(document.body);window.location.href.toLowerCase().contains("mylightboxes.aspx")?setGlassButtonDisabled($(CorbisUI.GlobalVars.Lightbox.subscriptionDownloadAllBtn),true):setGlassButtonDisabled(CorbisUI.GlobalVars.SearchResults.subscriptionDownloadAllBtn,true);OpenNewIModal(CorbisUI.GlobalVars.SearchResults.urls.downloadSubscription,640,540,"Subscription");}else{CorbisUI.Subscription.result=result;OpenNewIModal(CorbisUI.GlobalVars.SearchResults.urls.downloadSubscriptionException+"?DownloadResult="+result.Status,350,50,"SubscriptionExceptions");if(result.Status==8){document.body.getElement("div.subscriptionCounts").getElement(".remainingCount").set("text","0");}}},continueDownloadSuccess:function(result){if(result.Status==1){CorbisUI.Subscription.result=result;OpenNewIModal(CorbisUI.GlobalVars.SearchResults.urls.downloadSubscription,640,540,"Subscription");}else{CorbisUI.Subscription.result=result;OpenNewIModal(CorbisUI.GlobalVars.SearchResults.urls.downloadSubscriptionException+"?DownloadResult="+result.Status,350,50,"SubscriptionExceptions");}},emptySubscriptionBuddy:function(iBody){iBody.getElement("div.subscriptionCounts").getElement(".imageCount").set("text","0");if(iBody.getElement("div.subscriptionCounts").getElement(".remainingCount").get("text")=="0"&&iBody.getElement("div.subscriptionCounts").getElement(".imageCount").get("text")=="0"){if(iBody.getElement("div.subscriptionContainer").getElement(".centerMe")){iBody.getElement("div.subscriptionContainer").getElement(".centerMe").setStyle("display","none");}if(CorbisUI.DomCache.get("subscriptionContainer").getElement(".remainingZerocenterMe")){iBody.getElement("div.subscriptionContainer").getElement(".remainingZerocenterMe").setStyle("display","block");}}},setDownloadInfo:function(result){var downloadDiv=$("download");var linksContainer=downloadDiv.getElement("div.downloadLinks");linksContainer.empty();if(!result){CorbisUI.Subscription.DownloadImageFailed(null);return;}$("orderNumber").set("text",result.OrderNumber);$("projectName").set("text",result.ProjectName);$("emailedTo").set("text",result.ConfirmationEmail);downloadDiv.removeClass("hdn");if(parent.location.pathname.toLowerCase().endsWith("mylightboxes.aspx")){if(result&&result.PackagedCorbisIds){for(var i=0;i<result.PackagedCorbisIds.length;i++){var corbisId=result.PackagedCorbisIds[i];var mediaId=parent.CorbisUI.ProductCache.get(corbisId);var product=parent.CorbisUI.ProductCache.get(mediaId);if(product){product.updateIcon("SB","deselectIcon");}}}CorbisUI.Subscription.Refresh();}else{if(result&&result.PackagedCorbisIds){for(var i=0;i<result.PackagedCorbisIds.length;i++){var corbisId=result.PackagedCorbisIds[i];var mediaId=parent.CorbisUI.ProductCache.get(corbisId);var product=parent.CorbisUI.ProductCache.get(mediaId);if(product){product.updateIcon("SB","deselectIcon");}}}CorbisUI.Subscription.Refresh();}var zipPattern=new RegExp(/[.]zip/i);var showHelpText=false;result.DownloadPackages.each(function(el){showHelpText=showHelpText||zipPattern.test(el.Key);var newLink=new Element("a",{href:el.Value,html:el.Key});newLink.inject(linksContainer,"bottom");var win;if(Browser.Engine.webkit){win=window.open(el.Value,"_blank","height=1,width=1");win.setTimeout("self.close();",5000);}else{win=window.open(el.Value,"_blank","height=100,width=100");}});var dotDiv=downloadDiv.getElement("div.dots");var helpTextDiv=downloadDiv.getElement("div.helpText");if(showHelpText){dotDiv.removeClass("hdn");helpTextDiv.removeClass("hdn");}else{if(!dotDiv.hasClass("hdn")){dotDiv.addClass("hdn");}if(!helpTextDiv.hasClass("hdn")){helpTextDiv.addClass("hdn");}}if(window.parent.MVCTilePage){window.parent.picplanDownloadCallbackOverride();}},DownloadImageFailed:function(result){if(!executer.get_aborted()){OpenModal("subscriptiondownloaderrormodal");window.frames[0].$("modalOverlay").setStyle("opacity",0.7);}},Refresh:function(){parent.CorbisUI.Search.Handler.refreshsubScriptioinBuddy();},updateRemaining:function(result){parent.document.body.getElement("span.remainingCount").set("text",result.toString());},methodFailed:function(results,methodName){alert(results.get_message());},OpenProgressModal:function(url){var options={cornerRadius:0,headerHeight:0,footerHeight:0,contentBgColor:"transparent",useCanvas:false,createFromHTML:false};new CorbisUI.Popup("downloadProgress",options);window.frames[0].$("modalOverlay").setStyle("opacity",0.7);window.frames[0].$(parent.document).getElement("#SubscriptionWindow_overlay").setStyles({"background-image":"url(../Images/SubscriptionProgressBackground.gif)","background-repeat":"no-repeat"});},HideProgressModal:function(){$(parent.document).getElement("#SubscriptionWindow_overlay").setStyle("background-image","none");HideModal("downloadProgress");},CancelDownload:function(){if(executer&&executer.get_started()){executer.abort();}this.HideProgressModal();},SetFileSize:function(size){$("selectImage").getElements("select.fileSize").each(function(el){el.selectedIndex=(size=="smallest"?el.options.length-1:0);});},OpenProgressModal:function(){keyWatch.start();var options={cornerRadius:0,headerHeight:0,footerHeight:0,contentBgColor:"transparent",useCanvas:false};new CorbisUI.Popup("downloadProgress",options);$("modalOverlay").setStyle("opacity",0.8);},OpenExpireModal:function(){new CorbisUI.Popup("picplanExpireModal",{showModalBackground:false,closeOnLoseFocus:true,positionVert:0,positionHoriz:0});ResizeModal("picplanExpireModal");var expireModal=document.body.getElement("img.picPlanExpired");$("picplanExpireModalWindow").setStyles({top:expireModal.offsetHeight+40,left:expireModal.offsetWidth+90});}};var timer,timer2,thumbTips,noLicense,noCat,noColor,noPhoto;var _clarifyCheckCount=0;var stopSearch=false;if(typeof(CorbisUI)=="undefined"){CorbisUI={};}if(typeof(CorbisUI.Search)=="undefined"){CorbisUI.Search={};CorbisUI.ProductTooltip=null;}if(typeof(CorbisUI.Handlers)=="undefined"){CorbisUI.Handlers={};}if(typeof(CorbisUI.ProductCache)=="undefined"){CorbisUI.ProductCache=new CorbisUI.CachingClass();}if(typeof(CorbisUI.Search.AutoCompleteDisplayOptions)=="undefined"){CorbisUI.Search.AutoCompleteDisplayOptions={};}CorbisUI.Search={MoveQuickPick:function(ctl,ctl2,corbisId,Url128,licenseModel,aspectRatio,title,toQuickPick){if(CorbisUI.SearchBuddy.init.activeTab!="quickpic"){var qp=CorbisUI.SearchBuddy.init.tabs.get("quickpic");qp.el.fireEvent("click");}if(toQuickPick){CorbisUI.ServiceManager.SearchOld.SearchScriptService.AddItemToQuickPick(corbisId,Url128,licenseModel,aspectRatio,title,updateQuickPicView,methodFailed);var item=$(ctl);item.getParent().addClass("hdn");var hideQP=item.getParent("ul").getElement(".QP_off");if(hideQP){hideQP.removeClass("hdn");}}else{CorbisUI.ServiceManager.SearchOld.SearchScriptService.RemoveItemFromQuickPick(corbisId,updateQuickPicView,methodFailed);var item=$(ctl);item.getParent().addClass("hdn");var ulItem=item.getParent("ul");if(ulItem){var showQP=ulItem.getElement(".QP_on");if(showQP){showQP.removeClass("hdn");}}}},WindowScrollFX:null,SetPageFocus:function(){if(this.WindowScrollFX==null){this.WindowScrollFX=new Fx.Scroll($(window),{offset:{x:0,y:0}});}if($("ProductResults")!=null){this.WindowScrollFX.toTop();}}};CorbisUI.QueueManager.addQueue("SearchMacros",{canRerun:true,delay:true}).addItem("pageScrollToTop",function(){CorbisUI.Search.SetPageFocus();});CorbisUI.Search.Handler={fetchProductObject:function(id,idType){switch(idType){case"productuid":return CorbisUI.ProductCache.get(id);break;case"corbisid":var productuid=CorbisUI.ProductCache.get(id);return CorbisUI.ProductCache.get(productuid);break;}},selectQuickpicIcon:function(id,idType){var product=this.fetchProductObject(id,idType);(function(){product.refreshObject().updateIcon("QP","selectIcon");}).delay(200);},deselectQuickpicIcon:function(id,idType){var product=this.fetchProductObject(id,idType);(function(){product.refreshObject().updateIcon("QP","deselectIcon");}).delay(200);},syncLightboxToImages:function(){CorbisUI.Handlers.Lightbox.syncLightboxToImages();},addProductToCart:function(corbisId){if(CorbisUI.Auth.GetSignInLevel()<1){CorbisUI.Auth.Check(1,CorbisUI.Auth.ActionTypes.Execute,"CorbisUI.Search.Handler.doAddProductToCart('"+corbisId+"')");}else{CorbisUI.Search.Handler.doAddProductToCart(corbisId);}},doAddProductToCart:function(corbisId,reloadPage){var mediaId=CorbisUI.ProductCache.get(corbisId);var product=CorbisUI.ProductCache.get(mediaId);if(product){product.refreshObject().setRefreshPage(reloadPage).addProductToCart();}},refreshCartItem:function(corbisId,cartItemCount){var mediaId=CorbisUI.ProductCache.get(corbisId);CorbisUI.Handlers.Cart.refreshItemAdded(mediaId,corbisId,cartItemCount);},refreshsubScriptioinBuddy:function(){CorbisUI.Handlers.Subscription.getSubscriptionItems();var subscriptionTab=CorbisUI.DomCache.get("SearchBuddy").getElement("li.SBT_subscriptions");CorbisUI.ServiceManager.SearchOld.SearchScriptService.GetRemainingDownloadCount(CorbisUI.Search.Handler.updateRemaining,CorbisUI.Handlers.Subscription.methodFailed);},updateRemaining:function(result){document.body.getElement("span.remainingCount").set("text",result.toString());if(result==0){CorbisUI.DomCache.get("subscriptionContainer").getElements(".subscriptionBlock").each(function(el){el.destroy();});}var count=CorbisUI.DomCache.get("subscriptionContainer").getElements("div.subscriptionBlock").length;if(count>0){CorbisUI.DomCache.get("subscriptionContainer").setProperty("imageCount",count);document.body.getElement("span.imageCount").set("text",count);}else{if(count==0&&result==0){CorbisUI.DomCache.get("subscriptionContainer").setProperty("imageCount","0");document.body.getElement("span.imageCount").set("text","0");if(document.body.getElement("div.subscriptionContainer").getElement(".centerMe")!=null){var msg=CorbisUI.GlobalVars.SearchResults.text.remainingZeoSubscriptionMessage.replace("{0}",CorbisUI.GlobalVars.SearchResults.text.additionalPrice);document.body.getElement("div.subscriptionContainer").getElement(".centerMe").set("html",msg);document.body.getElement("div.subscriptionContainer").getElement(".centerMe").setStyle("display","block");}else{if(document.body.getElement("div.subscriptionContainer").getElement(".remainingZerocenterMe")!=null){document.body.getElement("div.subscriptionContainer").getElement(".remainingZerocenterMe").setStyle("display","block");}}}}},refreshQuickPicBuddy:function(){var quickpicField=CorbisUI.DomCache.get("SBBX_quickpic").getElement("input[id$=quickpicField]");quickpicField.onclick();var quickpicTab=CorbisUI.DomCache.get("SearchBuddy").getElement("li.SBT_quickpic");quickpicTab.fireEvent("click");}};CorbisUI.Handlers.Lightbox={delayedLoadItem:false,currentLightboxItems:null,corbisIdToAdd:null,afterSignIn_cookieEvent:function(vars){var lightboxId=CorbisUI.DomCache.get("SBBX_lightboxes").getElement("select.lightboxList").getSelected()[0].value;CorbisUI.ServiceManager.SearchOld.SearchScriptService.AddSearchItemToLightbox(vars.MID,lightboxId,function(){CorbisUI.SearchBuddy.activateTab("lightboxes");},CorbisUI.Handlers.Lightbox.methodFailed);},afterSignIn:function(CorbisId){var mediaId=CorbisUI.ProductCache.get(CorbisId);CorbisUI.CookieEvents.addCookieEvent(function(){CorbisUI.Handlers.Lightbox.afterSignIn_cookieEvent(this.vars);},{CID:CorbisId,MID:mediaId});window.location.reload();},addTo:function(CorbisId){if(CorbisUI.Auth.GetSignInLevel()<1){CorbisUI.Auth.Check(1,CorbisUI.Auth.ActionTypes.Execute,"CorbisUI.Handlers.Lightbox.afterSignIn('"+CorbisId+"'); ");}else{CorbisUI.Handlers.Lightbox.addProductToLightbox(CorbisId);}},addProductToLightbox:function(CorbisId,reloadPage){LogOmnitureEvent("event12");var mediaId=CorbisUI.ProductCache.get(CorbisId);var product=CorbisUI.ProductCache.get(mediaId);product.refreshObject().setupObject();if(reloadPage){product.refreshPage=reloadPage;}if(!product.activeStates.LB){if(CorbisUI.DomCache.get("SBBX_lightboxes").getElement("select.lightboxList").getSelected()[0]){var lightboxId=CorbisUI.DomCache.get("SBBX_lightboxes").getElement("select.lightboxList").getSelected()[0].value;if(!CorbisUI.SearchBuddy.init.tabs.get("lightboxes").dataLoaded&&!window.location.href.contains("imagegroups")){CorbisUI.Handlers.Lightbox.delayedLoadItem={CID:product.corbisID,MID:mediaId,LBID:lightboxId,HANDLER:CorbisUI.Handlers.Lightbox.addToResponseNew,METHODFAILED:CorbisUI.Handlers.Lightbox.methodFailed};}else{CorbisUI.ServiceManager.SearchOld.SearchScriptService.AddSearchItemToLightboxNew(product.corbisID,mediaId,lightboxId,CorbisUI.Handlers.Lightbox.addToResponseNew,CorbisUI.Handlers.Lightbox.methodFailed);}}else{CorbisUI.Handlers.Lightbox.corbisIdToAdd=CorbisId;openCreateLightbox();}CorbisUI.SearchBuddy.init.tabs.get("lightboxes").el.fireEvent("click");}},reloadLightbox:function(lightboxId,lightboxName){var lightboxList;var isMediasetSearch=false;if(CorbisUI.DomCache.get("SBBX_lightboxes")){lightboxList=CorbisUI.DomCache.get("SBBX_lightboxes").getElement("select.lightboxList");}else{if(CorbisUI.DomCache.get("SBBX_filters")){lightboxList=CorbisUI.DomCache.get("SBBX_filters").getElement("select.lightboxList");isMediasetSearch=true;}}if(lightboxList){if(lightboxName){var option=new Option(lightboxName,lightboxId);try{lightboxList.add(option,null);}catch(Error){lightboxList.add(option);}}var curLightboxId=lightboxList.getSelected()[0].value;if(curLightboxId!=lightboxId){var curLightbox=lightboxList.getElement("option[value="+lightboxId+"]");if(curLightbox){curLightbox.selected=true;}}if(isMediasetSearch){$(CorbisUI.GlobalVars.SearchResults.refreshLightboxControl).onclick();}else{if(CorbisUI.SearchBuddy.init.tabs.get("lightboxes").dataLoaded||CorbisUI.SearchBuddy.init.tabs.get("lightboxes").buddy.activeTab=="lightboxes"){CorbisUI.Handlers.Lightbox.getLightboxItems(lightboxId);}if(CorbisUI.SearchBuddy.init.tabs.get("lightboxes").buddy.activeTab!="lightboxes"){CorbisUI.SearchBuddy.init.tabs.get("lightboxes").el.fireEvent("click");}}}},addToResponseNew:function(result,context,methodName){new CorbisUI.SearchModels.lightboxBlock(result.MediaUID,result.CorbisID,{direction:"top"},result.RealProductUid);var count=CorbisUI.DomCache.get("LBXContainer").getElements("div.lightboxBlock").length;CorbisUI.Handlers.Lightbox.emptyItemDisplay(count);var imageCountProperty=CorbisUI.DomCache.get("LBXContainer").getProperty("imageCount");var imageCount=parseInt(imageCountProperty);if(!isNaN(imageCount)){imageCount+=1;}else{imageCount=CorbisUI.DomCache.get("LBXContainer").getElements("div.lightboxBlock").length;}CorbisUI.DomCache.get("LBXContainer").setProperty("imageCount",imageCount.toString());},addToResponse:function(results,context,methodName){new CorbisUI.SearchModels.lightboxBlock(results,null,{direction:"top"});var count=CorbisUI.DomCache.get("LBXContainer").getElements("div.lightboxBlock").length;CorbisUI.Handlers.Lightbox.emptyItemDisplay(count);},deleteItem:function(el){},deleteItemResponse:function(results,context,methodName){},emptyItemDisplay:function(count){if(CorbisUI.DomCache.get("LBXContainer").getElement(".centerMe")!=null){CorbisUI.DomCache.get("LBXContainer").getElement(".centerMe").setStyle("display",(count==0)?"block":"none");}},getLightboxItems:function(lightboxId){CorbisUI.DomCache.get("lightboxProgress").setStyle("display","block");if($type(CorbisUI.Handlers.Lightbox.currentLightboxItems)=="array"){CorbisUI.Handlers.Lightbox.currentLightboxItems.stopChunk();}CorbisUI.ServiceManager.SearchOld.SearchScriptService.GetLightBoxItemsV2(lightboxId,CorbisUI.Handlers.Lightbox.getLightboxItemsResponse,CorbisUI.Handlers.Lightbox.methodFailed);},getLightboxItemsResponse:function(results,context,methodName){CorbisUI.DomCache.get("lightboxProgress").setStyle("display","none");CorbisUI.DomCache.get("LBXContainer").getElements(".lightboxBlock").each(function(el){el.destroy();});CorbisUI.DomCache.get("LBXContainer").setProperty("imageCount",results.length);var tmpURL=window.location.href;if(tmpURL.indexOf("SearchTips")<0){CorbisUI.Handlers.Lightbox.syncLightboxToImages();}if(CorbisUI.Handlers.Lightbox.delayedLoadItem){var delayed=CorbisUI.Handlers.Lightbox.delayedLoadItem;CorbisUI.ServiceManager.SearchOld.SearchScriptService.AddSearchItemToLightboxNew(delayed.CID,delayed.MID,delayed.LBID,delayed.HANDLER,delayed.METHODFAILED);CorbisUI.Handlers.Lightbox.delayedLoadItem=false;}CorbisUI.Handlers.Lightbox.emptyItemDisplay(results.length);if(results.length>0){CorbisUI.Handlers.Lightbox.currentLightboxItems=results;CorbisUI.Handlers.Lightbox.currentLightboxItems.flip().chunk(CorbisUI.Handlers.Lightbox.chunkProcess,50);}},methodFailed:function(results,context,methodName){if(methodName=="GetLightBoxItems"){CorbisUI.DomCache.get("lightboxProgress").setStyle("display","none");CorbisUI.DomCache.get("LBXContainer").getElements(".lightboxBlock").each(function(el){el.destroy();});CorbisUI.Handlers.Lightbox.resetLightboxToImages();CorbisUI.Handlers.Lightbox.emptyItemDisplay(results.length);alert(results.get_message());}},chunkProcess:function(item){new CorbisUI.SearchModels.lightboxBlock(item);},syncLightboxToImages:function(){CorbisUI.DomCache.get("ProductResults").getElements("span.ProductBlock").each(function(el){var productid=el.getProperty("productuid");var productBlock=CorbisUI.ProductCache.get(productid);if(productBlock.checkLightboxStatus()){productBlock.updateIcon("LB","deselectIcon");}});if(CorbisUI.DomCache.get("SBBX_lightboxes")!=null){CorbisUI.DomCache.get("SBBX_lightboxes").getElements("div.lightboxBlock").each(function(el){var productBlock=CorbisUI.ProductCache.get(el.getProperty("mediaUid"));if(productBlock!=null){productBlock.refreshObject().updateIcon("LB","selectIcon");}});}},refreshItemAdded:function(corbisId,lightboxId,newLightboxName){var mediaId=CorbisUI.ProductCache.get(corbisId);var product=CorbisUI.ProductCache.get(mediaId);if(product){product.refreshObject().updateIcon("LB","selectIcon");}this.reloadLightbox(lightboxId,newLightboxName);}};CorbisUI.Handlers.Quickpic={downloadAll:function(){if(CorbisUI.Auth.GetSignInLevel()<2){CorbisUI.Auth.Check(2,CorbisUI.Auth.ActionTypes.Execute,"CorbisUI.Handlers.Quickpic.downloadAll_openModal()");}else{CorbisUI.Handlers.Quickpic.downloadAll_openModal();}},downloadAll_openModal:function(){if($("quickPicsContainer").getElements("div.quickPicBlock").length>0){OpenNewIModal(CorbisUI.GlobalVars.SearchResults.urls.downloadQuickPic,640,540,"QuickPic");}},moveQuickpic:function(ctl,corbisId,Url128,licenseModel,aspectRatio,title){var item=$(ctl).getParent();var method=(item.hasClass("QP_on"))?"delete":"add";if(window.location.href.toLowerCase().contains("mylightboxes.aspx")){var pageInit=CorbisUI.MyLightboxes.init;}else{var pageInit=CorbisUI.SearchBuddy.init;}if(pageInit.activeTab!="quickpic"){var qp=pageInit.tabs.get("quickpic");qp.el.fireEvent("click");}switch(method){case"add":CorbisUI.Handlers.Quickpic.addTo(corbisId,Url128,licenseModel,aspectRatio,title);break;}},addTo:function(corbisId,Url128,licenseModel,aspectRatio,title){LogOmnitureEvent("event15");CorbisUI.ServiceManager.SearchOld.SearchScriptService.AddItemToQuickPick(corbisId,Url128,licenseModel,aspectRatio,title,CorbisUI.Handlers.Quickpic.addToResponse,CorbisUI.Handlers.Quickpic.addTo_methodFailed);},addToResponse:function(results,context,methodName){var corbisId=results;console.log(corbisId);if(corbisId===""||corbisId===null){new CorbisUI.Popup("quickpicMaximumAlert",{showModalBackground:false,closeOnLoseFocus:true,positionVert:"middle",positionHoriz:"right"});ResizeModal("quickpicMaximumAlert");}else{if(!CorbisUI.ProductCache.has(results)&&window.location.pathname.toLowerCase().endsWith("mylightboxes.aspx")){var productBlock=new CorbisUI.Lightbox.ProductBlock(results);}var mediaId=CorbisUI.ProductCache.get(results);var product=CorbisUI.ProductCache.get(mediaId);if(CorbisUI.ProductCache.get("quickPicsContainer").getElement("div[corbisid="+results+"]")==null){new CorbisUI.SearchModels.quickPicBlock(mediaId,results);}var centerMe=CorbisUI.ProductCache.get("quickPicsContainer").getElement(".centerMe");if(!centerMe.hasClass("hdn")){centerMe.addClass("hdn");centerMe.setStyle("display","none");}CorbisUI.Handlers.Quickpic.emptyItemDisplay(1);}},addTo_methodFailed:function(results,context,methodName){alert(results.get_message());},deleteItem:function(corbisId){CorbisUI.ServiceManager.SearchOld.SearchScriptService.RemoveItemFromQuickPick(corbisId,CorbisUI.Handlers.Quickpic.deleteItemResponse,CorbisUI.Handlers.Quickpic.deleteItem_methodFailed);},deleteItemResponse:function(results,context,methodName){var mediaId=CorbisUI.ProductCache.get(results);var product=CorbisUI.ProductCache.get(mediaId);if(product){product.updateIcon("QP","deselectIcon");}if(CorbisUI.ProductCache.get("quickPicsContainer").getElement("div[corbisid="+results+"]")!=null){CorbisUI.ProductCache.get("quickPicsContainer").getElement("div[corbisid="+results+"]").destroy();}var qpBlocks=CorbisUI.ProductCache.get("quickPicsContainer").getElements(".quickPicBlock");if(qpBlocks.length==0){CorbisUI.ProductCache.get("quickPicsContainer").getElement(".centerMe").removeClass("hdn");CorbisUI.ProductCache.get("quickPicsContainer").getElement(".centerMe").setStyle("display","block");}else{CorbisUI.ProductCache.get("quickPicsContainer").getElement(".centerMe").addClass("hdn");CorbisUI.ProductCache.get("quickPicsContainer").getElement(".centerMe").setStyle("display","none");}CorbisUI.Handlers.Quickpic.emptyItemDisplay(qpBlocks.length);},deleteItem_methodFailed:function(results,context,methodName){alert(results.get_message());},emptyItemDisplay:function(count){if(CorbisUI.GlobalVars.SearchResults){if(CorbisUI.GlobalVars.SearchResults.quickPicDownloadAllBtn!=null){setGlassButtonDisabled(CorbisUI.GlobalVars.SearchResults.quickPicDownloadAllBtn,count==0);}}if(CorbisUI.GlobalVars.Lightbox){if(CorbisUI.GlobalVars.Lightbox.quickPicDownloadAllBtn!=null){setGlassButtonDisabled(CorbisUI.GlobalVars.Lightbox.quickPicDownloadAllBtn,count==0);}}},refreshItemAdded:function(corbisId){var mediaId=CorbisUI.ProductCache.get(corbisId);var product=CorbisUI.ProductCache.get(mediaId);if(product){product.refreshObject().updateIcon("QP","selectIcon");}CorbisUI.Search.Handler.refreshQuickPicBuddy();this.emptyItemDisplay(1);}};CorbisUI.Handlers.Subscription={delayedLoadItem:false,downloadAll:function(){if(CorbisUI.Auth.GetSignInLevel()<2){CorbisUI.Auth.Check(2,CorbisUI.Auth.ActionTypes.Execute,"CorbisUI.Handlers.Subscription.downloadAll_openModal()");}else{var remainingCount=document.body.getElement("div.subscriptionCounts").getElement(".remainingCount").get("text");if(remainingCount!=null){CorbisUI.Subscription.DownloadSubscriptionImages(remainingCount,false,false);}}},downloadAll_openModal:function(){if($("subscriptionContainer").getElements("div.subscriptionBlock").length>0){OpenNewIModal(CorbisUI.GlobalVars.SearchResults.urls.downloadSubscription,640,540,"Subscription");}},afterSignIn:function(CorbisId){var mediaId=CorbisUI.ProductCache.get(CorbisId);CorbisUI.CookieEvents.addCookieEvent(function(){CorbisUI.Handlers.Subscription.afterSignIn_cookieEvent(this.vars);},{CID:CorbisId,MID:mediaId});window.location.reload();},addTo:function(CorbisId){if(CorbisUI.Auth.GetSignInLevel()<1){CorbisUI.Auth.Check(1,CorbisUI.Auth.ActionTypes.Execute,"CorbisUI.Handlers.Subscription.afterSignIn('"+CorbisId+"'); ");}else{CorbisUI.Handlers.Subscription.addProductToSubscription(CorbisId);}},addProductToSubscription:function(CorbisId,reloadPage){var mediaId=CorbisUI.ProductCache.get(CorbisId);var product=CorbisUI.ProductCache.get(mediaId);product.refreshObject().setupObject();if(reloadPage){product.refreshPage=reloadPage;}var LBPage=(window.location.href.toLowerCase().contains("mylightboxes.aspx"))?true:false;if(!product.activeStates.SB&&CorbisUI.DomCache.get("SBBX_subscriptions")){var CorbisID=(LBPage)?CorbisId:product.corbisID;var MediaID=(LBPage)?product.mediaUID:mediaId;var ActionObject=(LBPage)?"MyLightboxes":"SearchBuddy";CorbisUI.ServiceManager.SearchOld.SearchScriptService.AddSearchItemToSubscriptionNew(CorbisID,MediaID,CorbisUI.Handlers.Subscription.addToResponseNew,CorbisUI.Handlers.Subscription.methodFailed);CorbisUI[ActionObject].init.tabs.get("subscriptions").el.fireEvent("click");}},addToResponseNew:function(result,context,methodName){if(result==null){new CorbisUI.Popup("subscriptionMaximumAlert",{showModalBackground:false,closeOnLoseFocus:true,positionVert:"middle",positionHoriz:"right"});ResizeModal("subscriptionMaximumAlert");}else{LogOmnitureEvent("event45");new CorbisUI.SearchModels.subscriptionBlock(result.MediaUID,result.CorbisID,{direction:"top"},null);var imageCount=parseInt(CorbisUI.DomCache.get("subscriptionContainer").getProperty("imageCount"));if(!isNaN(imageCount)){imageCount++;CorbisUI.DomCache.get("subscriptionContainer").setProperty("imageCount",imageCount);CorbisUI.DomCache.get("SBBX_subscriptions").getElement("span.imageCount").set("text",imageCount);}if(window.location.href.toLowerCase().contains("mylightboxes.aspx")){setGlassButtonDisabled($(CorbisUI.GlobalVars.Lightbox.subscriptionDownloadAllBtn),false);}else{setGlassButtonDisabled(CorbisUI.GlobalVars.SearchResults.subscriptionDownloadAllBtn,false);}if(document.body.getElement("div.subscriptionContainer").getElement(".centerMe")!=null){document.body.getElement("div.subscriptionContainer").getElement(".centerMe").setStyle("display","none");}if(document.body.getElement("div.subscriptionContainer").getElement(".remainingZerocenterMe")!=null){document.body.getElement("div.subscriptionContainer").getElement(".remainingZerocenterMe").setStyle("display","none");}}},deleteItem:function(mediaUid){CorbisUI.ServiceManager.SearchOld.SearchScriptService.DeleteSubscriptionItem(mediaUid,CorbisUI.Handlers.Subscription.deleteItemResponse,CorbisUI.Handlers.Subscription.deleteItem_methodFailed);},deleteItemResponse:function(results,context,methodName){console.log("CALLING: CorbisUI.Handlers.Quickpic.deleteItemResponse");var mediaId=CorbisUI.ProductCache.get(results);var product=CorbisUI.ProductCache.get(mediaId);if(product){product.updateIcon("SB","deselectIcon");}if(CorbisUI.ProductCache.get("subscriptionContainer").getElement("div[corbisid="+results+"]")!=null){CorbisUI.ProductCache.get("subscriptionContainer").getElement("div[corbisid="+results+"]").destroy();}var sbBlocks=CorbisUI.ProductCache.get("subscriptionContainer").getElements(".subscriptionBlock");if(sbBlocks.length==0&&document.body.getElement("div.subscriptionContainer").getElement(".centerMe")!=null){CorbisUI.ProductCache.get("subscriptionContainer").getElement(".centerMe").removeClass("hdn");}CorbisUI.Handlers.Subscription.emptyItemDisplay(sbBlocks.length);CorbisUI.DomCache.get("SBBX_subscriptions").getElement("span.imageCount").set("text",sbBlocks.length.toString());if(window.location.href.toLowerCase().contains("mylightboxes.aspx")&&sbBlocks.length==0){setGlassButtonDisabled($(CorbisUI.GlobalVars.Lightbox.subscriptionDownloadAllBtn),true);}},deleteItem_methodFailed:function(results,context,methodName){alert(results.get_message());},getSubscriptionItems:function(){CorbisUI.ServiceManager.SearchOld.SearchScriptService.GetSubscriptionItems(CorbisUI.Handlers.Subscription.getSubscriptionItemsResponse,CorbisUI.Handlers.Subscription.methodFailed);},getSubscriptionItemsResponse:function(results,context,methodName){if(results!=null){CorbisUI.DomCache.get("subscriptionContainer").getElements(".subscriptionBlock").each(function(el){el.destroy();});CorbisUI.DomCache.get("subscriptionContainer").setProperty("imageCount",results.length);var tmpURL=window.location.href;if(tmpURL.indexOf("SearchTips")<0){CorbisUI.Handlers.Subscription.syncSuscriptionToImages();}if(CorbisUI.Handlers.Subscription.delayedLoadItem){var delayed=CorbisUI.Handlers.Subscription.delayedLoadItem;CorbisUI.ServiceManager.SearchOld.SearchScriptService.AddSearchItemToSubscriptionNew(delayed.CID,delayed.MID,null,delayed.HANDLER,delayed.METHODFAILED);CorbisUI.Handlers.Subscription.delayedLoadItem=false;}CorbisUI.Handlers.Subscription.emptyItemDisplay(results.length);if(results.length>0){CorbisUI.Handlers.Subscription.currentLightboxItems=results;CorbisUI.Handlers.Subscription.currentLightboxItems.chunk(CorbisUI.Handlers.Subscription.chunkProcess,25);CorbisUI.DomCache.get("subscriptionContainer").setProperty("imageCount",results.length.toString());CorbisUI.DomCache.get("SBBX_subscriptions").getElement("span.imageCount").set("text",results.length.toString());if(window.location.href.toLowerCase().contains("mylightboxes.aspx")){setGlassButtonDisabled($(CorbisUI.GlobalVars.Lightbox.subscriptionDownloadAllBtn),false);}}}},emptyItemDisplay:function(count){if(CorbisUI.GlobalVars.SearchResults){if(CorbisUI.GlobalVars.SearchResults.subscriptionDownloadAllBtn!=null){setGlassButtonDisabled(CorbisUI.GlobalVars.SearchResults.subscriptionDownloadAllBtn,count==0);}}if(CorbisUI.DomCache.get("subscriptionContainer").getElement(".centerMe")!=null){CorbisUI.DomCache.get("subscriptionContainer").getElement(".centerMe").setStyle("display",(count==0&&document.body.getElement("div.subscriptionCounts").getElement(".remainingCount").get("text")!="0")?"block":"none");}if(CorbisUI.DomCache.get("subscriptionContainer").getElement(".remainingZerocenterMe")!=null){CorbisUI.DomCache.get("subscriptionContainer").getElement(".remainingZerocenterMe").setStyle("display",(count==0&&document.body.getElement("div.subscriptionCounts").getElement(".remainingCount").get("text")=="0")?"block":"none");}},chunkProcess:function(item){new CorbisUI.SearchModels.subscriptionBlock(item);},syncSuscriptionToImages:function(){CorbisUI.DomCache.get("ProductResults").getElements("span.ProductBlock").each(function(el){var productid=el.getProperty("productuid");var productBlock=CorbisUI.ProductCache.get(productid);});if(CorbisUI.DomCache.get("SBBX_subscriptions")!=null){CorbisUI.DomCache.get("SBBX_subscriptions").getElements("div.subscriptionBlock").each(function(el){var productBlock=CorbisUI.ProductCache.get(el.getProperty("mediaUid"));if(productBlock!=null){productBlock.refreshObject().updateIcon("SB","selectIcon");}});}},refreshSubscriptionItemAdded:function(result,context,methodName){if($(CorbisUI.GlobalVars.SearchResults.buddySignInLink)){window.location.reload();}else{new CorbisUI.SearchModels.subscriptionBlock(result.MediaUID,result.CorbisID,{direction:"top"},null);var count=CorbisUI.DomCache.get("subscriptionContainer").getElements("div.subscriptionBlock").length;CorbisUI.Handlers.Subscription.emptyItemDisplay(count);var imageCountProperty=CorbisUI.DomCache.get("subscriptionContainer").getProperty("imageCount");var imageCount=parseInt(imageCountProperty);if(!isNaN(imageCount)){imageCount+=1;}else{imageCount=CorbisUI.DomCache.get("subscriptionContainer").getElements("div.subscriptionBlock").length;}if(imageCount>0){if(document.body.getElement("div.subscriptionContainer").getElement(".centerMe")!=null){document.body.getElement("div.subscriptionContainer").getElement(".centerMe").addClass("hdn");}if(document.body.getElement("div.subscriptionContainer").getElement(".remainingZerocenterMe")!=null){document.body.getElement("div.subscriptionContainer").getElement(".remainingZerocenterMe").setStyle("display","none");}}CorbisUI.DomCache.get("subscriptionContainer").setProperty("imageCount",imageCount.toString());document.body.getElement("span.imageCount").set("text",imageCount.toString());if(window.location.href.toLowerCase().contains("mylightboxes.aspx")){if(CorbisUI.MyLightboxes.init.tabs.get("subscriptions")!=null){CorbisUI.MyLightboxes.init.tabs.get("subscriptions").el.fireEvent("click");}}else{if(CorbisUI.SearchBuddy.init.tabs.get("subscriptions")!=null){CorbisUI.SearchBuddy.init.tabs.get("subscriptions").el.fireEvent("click");}}}},refreshItemAdded:function(corbisId){var mediaId=CorbisUI.ProductCache.get(corbisId);var product=CorbisUI.ProductCache.get(mediaId);if(product){product.refreshObject().updateIcon("SB","selectIcon");}CorbisUI.Search.Handler.refreshsubScriptioinBuddy();this.emptyItemDisplay(1);},methodFailed:function(results,context,methodName){CorbisUI.MethodFailed(results,context,methodName);}};CorbisUI.Search.AutoCompleteDisplayOptions={setAutoCompleteOption:function(){var var_AC=$("moreDisplayOptionsWindow").getElement("div[id$=chk_AutoComplete]");var checkedState=CorbisUI.ImageCb.getImageCbObject(var_AC).getCheckedState();CorbisUI.Search.AutoCompleteDisplayOptions.AutoCompleteExtenderUpdateToggler(checkedState);CorbisUI.Search.AutoCompleteDisplayOptions.ChkAutoCompleteUpdater("setString");return false;},AutoCompleteExtenderUpdateToggler:function(result){CorbisUI.ServiceManager.SearchOld.SearchScriptService.displayOptionsAutoComplete(result,CorbisUI.Search.AutoCompleteDisplayOptions.AutoCompleteExtenderUpdateTogglerInner,CorbisUI.methodFailed);},AutoCompleteExtenderUpdateTogglerInner:function(result){var var_AutoCompleteDiv=$("KeywordsAutoComplete_Window");if(var_AutoCompleteDiv){if(result){if($("varDivAc_chkStatus")){$("varDivAc_chkStatus").innerHTML="true";}}else{$("KeywordsAutoComplete_Window").setStyle("display","none");if($("varDivAc_chkStatus")){$("varDivAc_chkStatus").innerHTML="false";}}}},ChkAutoCompleteUpdater:function(setOptionInPrm){var var_AC=null;var var_varDivAC=null;if($("moreDisplayOptionsWindow")){var_AC=$("moreDisplayOptionsWindow").getElement("div[id$=chk_AutoComplete]");}if($("varDivAc_chkStatus")){var_varDivAC=$("varDivAc_chkStatus");}if(setOptionInPrm=="setChkBox"){if(var_varDivAC){var statusBool=false;if(var_varDivAC.innerHTML.toLowerCase()=="true"){statusBool=true;}var var_AC=$("moreDisplayOptionsWindow").getElement("div[id$=chk_AutoComplete]");if(var_AC){CorbisUI.ImageCb.getImageCbObject(var_AC).setCheckState(statusBool,false);}}}else{if(setOptionInPrm=="setString"){var var_AC=$("moreDisplayOptionsWindow").getElement("div[id$=chk_AutoComplete]");if(var_AC){if(var_varDivAC){var_varDivAC.innerHTML=CorbisUI.ImageCb.getImageCbObject(var_AC).getCheckedState()+"";}}}}},ChkClarificationUpdater:function(setOptionInPrm){var var_AC=null;var var_varDivAC=null;if($("moreDisplayOptionsWindow")){var_AC=$("moreDisplayOptionsWindow").getElement("div[id$=termClarf]");}if($("varDivCl_chkStatus")){var_varDivAC=$("varDivCl_chkStatus");}if(setOptionInPrm=="setChkBox"){if(var_varDivAC){var statusBool=false;if(var_varDivAC.innerHTML.toLowerCase()=="true"){statusBool=true;}if(var_AC){CorbisUI.ImageCb.getImageCbObject(var_AC).setCheckState(statusBool,false);}}else{if(var_AC){if(var_varDivAC){var_varDivAC.innerHTML=CorbisUI.ImageCb.getImageCbObject(var_AC).getCheckedState()+"";}}}}else{if(setOptionInPrm=="setString"){if(var_AC){if(var_varDivAC){var_varDivAC.innerHTML=CorbisUI.ImageCb.getImageCbObject(var_AC).getCheckedState()+"";}}}}}};CorbisUI.Handlers.Cart={addTo:function(CorbisId){if(CorbisUI.Auth.GetSignInLevel()<1){var mediaId=CorbisUI.ProductCache.get(CorbisId);CorbisUI.Auth.Check(1,CorbisUI.Auth.ActionTypes.Execute,"CorbisUI.Handlers.Cart.addProductToCart_AfterLogIn('"+CorbisId+"','"+mediaId+"')");}else{CorbisUI.Handlers.Cart.addProductToCart(CorbisId);}},addProductToCart_AfterLogIn:function(CorbisId,mediaId){CorbisUI.CookieEvents.addCookieEvent(function(){var temp_Str="CorbisUI.Handlers.Cart.addProductToCart('"+this.vars.UID+"','media','"+this.vars.PrID+"');";setTimeout(temp_Str,200);},{UID:CorbisId,PrID:mediaId});setTimeout("window.location.reload();",500);},addProductToCart:function(CorbisId,reloadPage,mediaId_param){var product;var mediaId=CorbisUI.ProductCache.get(CorbisId);if(!mediaId){if(reloadPage){if(mediaId_param){if(reloadPage.toString()=="media"){var addToCart=new CorbisUI.Cart.AddToCart(mediaId_param);addToCart.addOfferingToCart();}}}}else{if(reloadPage){if(reloadPage.toString()=="media"){reloadPage=null;}}product=CorbisUI.ProductCache.get(mediaId);product.refreshObject().setupObject();if(reloadPage){product.refreshPage=reloadPage;}if(!product.activeStates.CT){var addToCart=new CorbisUI.Cart.AddToCart(product.productUID);addToCart.context=product;addToCart.onSuccess=CorbisUI.Handlers.Cart.addToResponse;if(reloadPage){addToCart.refreshPage=reloadPage;}addToCart.addOfferingToCart();}}},addToResponse:function(results,context){var thisItem;if(context){thisItem=context;}else{if(this.context){thisItem=this.context;}else{thisItem=this;}}thisItem.setupObject();thisItem.updateIcon("CT","selectIcon");var lightboxItem=CorbisUI.DomCache.get("LBXContainer").getElement("div[corbisid="+thisItem.corbisID+"]");if(lightboxItem){CorbisUI.Handlers.Lightbox.reloadLightbox(CorbisUI.DomCache.get("SBBX_lightboxes").getElement("select.lightboxList").value,null);}UpdateCartCount(results);if(thisItem.refreshPage){window.location=window.location;}},syncCartToImages:function(){CorbisUI.DomCache.get("productBlocks").each(function(el){var productid=el.getProperty("productuid");var productBlock=CorbisUI.ProductCache.get(productid);if(CorbisUI.cartMediaUidList.has(productid)){productBlock.updateIcon("CT","selectIcon");}});},refreshItemAdded:function(mediaId,corbisId,cartCount){if($(CorbisUI.GlobalVars.SearchResults.buddySignInLink)){window.location.reload();}else{var productBlock=CorbisUI.ProductCache.get(mediaId);if(productBlock){CorbisUI.Handlers.Cart.addToResponse(cartCount,productBlock);}else{var lightboxItem=$("LBXContainer").getElement("div[corbisid="+corbisId+"]");if(lightboxItem){CorbisUI.cartMediaUidList.set(mediaId,true);CorbisUI.Handlers.Lightbox.reloadLightbox(CorbisUI.DomCache.get("SBBX_lightboxes").getElement("select.lightboxList").value,null);}UpdateCartCount(cartCount);}}}};CorbisUI.cartMediaUidList=new Hash({});function getCartMediaUidListResponse(results,context,methodName){results.each(function(item){CorbisUI.cartMediaUidList.set(item,true);});}CorbisUI.QueueManager.addQueue("searchDomReady",{canRerun:true,delay:true}).addItem("domCacheSetup",function(){CorbisUI.ServiceManager.SearchOld.SearchScriptService.GetCartMediaUidList(getCartMediaUidListResponse);CorbisUI.DomCache.add(["ProductResults","hiddenWorkshop","LBXContainer","SBBX_lightboxes","cartCount","quickPicsContainer","SearchBuddy","modalOverlay","FooterContent","searchProgIndicator"]);if(document.getElements("span.ProductBlock").length>0){CorbisUI.DomCache.addCollection("productBlocks",CorbisUI.DomCache.get("ProductResults").getElements("span.ProductBlock"));}if($("goBtn")!=null){var removeAction=";$('goBtn').getElement('a').removeAttribute('href');";var href=$("goBtn").getElement("a").getAttribute("href")+removeAction;$("goBtn").getElement("a").setAttribute("href",href);}}).addItem("simplestuff",function(){CorbisUI.ProductTooltip=new CorbisUI.Tooltip("#ProductResults .thumbWrap",{className:"TIP-product-block",onHide:function(tip){if(showTooltip()){tip.fade(this.options.hideMethod);}},onShow:function(tip){if(showTooltip()){tip.fade(this.options.showMethod);}}});if($("EditorialChildren")!=null){CorbisUI.ExtendedSearch.setCheckedState_flyout($("EditorialChildren").getElement("div[id$=documentary]"));CorbisUI.ExtendedSearch.setCheckedState_flyout($("CreativeChildren").getElement("div[id$=rightsManaged]"));}noPeopleChanged(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.noPeople);}).addItem("productBlockSetup",function(){if(document.getElements("span.ProductBlock").length>0){CorbisUI.DomCache.get("productBlocks").each(function(el){var item=new CorbisUI.SearchModels.ProductBlock(el);});}}).addItem("finalItems",function(){if($(CorbisUI.GlobalVars.SearchResults.showClarificationPopup)){var displayClarificationPopup=$(CorbisUI.GlobalVars.SearchResults.showClarificationPopup);if(displayClarificationPopup.value=="true"||displayClarificationPopup.value=="True"){OpenAmbiguousModal();}}var getZeroSearchResults=$(CorbisUI.GlobalVars.SearchResults.zeroSearchResults).value;if(getZeroSearchResults=="True"){applyZeroResultsStyles();}if(window.location.href.toLowerCase().contains("imagegroups.aspx")){this.dataLoaded=true;var selectedList=CorbisUI.DomCache.get("SBBX_lightboxes").getElement("select.lightboxList");if(selectedList!=null&&selectedList.getSelected()[0]!=null){var selectedIndex=selectedList.selectedIndex;var lightboxId=selectedList.options[selectedIndex].value;CorbisUI.Handlers.Lightbox.getLightboxItems(lightboxId);}}});if(window.location.href.toLowerCase().contains("searchresults.aspx")||window.location.href.toLowerCase().contains("imagegroups.aspx")){CorbisUI.QueueManager.searchDomReady.setupDomReady();}function methodFailed(results,context,methodName){alert(results.get_message());}function endRequestHandler(sender,args){if(sender._postBackSettings.sourceElement&&(sender._postBackSettings.sourceElement.id.contains("quickpicField")||sender._postBackSettings.sourceElement.id.contains("subScriptioinField")||sender._postBackSettings.sourceElement.id.contains("addToLightboxBtn"))){return;}}function showTooltip(){var previewCb=$("header2").getElement("div[id$=previewCheckbox]");if(previewCb==null){return true;}if(CorbisUI.ImageCb.getImageCbObject(previewCb)==null){return true;}var previewValue=CorbisUI.ImageCb.getImageCbObject(previewCb).getCheckedState()?"0":"1";return previewValue=="0";}function InitiateTimer(){if(timer!=null){window.clearInterval(timer);}timer=window.setInterval("window.clearInterval(timer);if (testSBCategoriesChecked()) secondTimer()",2000);}function resetSearchCategoryChecks(){if(timer!=null){window.clearInterval(timer);}if(timer2!=null){window.clearInterval(timer2);}if(CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.subscriptionOnly)){CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.subscriptionOnly).setCheckState(false,true);}CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.creative).setCheckState(true,true);CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.editorial).setCheckState(true,true);CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.rmLicense).setCheckState(true,true);CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.rfLicense).setCheckState(true,true);CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.noPeople).setCheckState(false,true);CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.photography).setCheckState(true,true);CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.illustration).setCheckState(true,true);CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.color).setCheckState(true,true);CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.blackWhite).setCheckState(true,true);CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.onlyModelReleased).setCheckState(false,true);}function testSBCategoriesChecked(){if(window.location.href.toLowerCase().contains("searchresults.aspx")){noLicense=!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.rmLicense).getCheckedState()&&!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.rfLicense).getCheckedState();noCat=!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.editorial).getCheckedState()&&!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.creative).getCheckedState();noPhoto=!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.photography).getCheckedState()&&!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.illustration).getCheckedState();noColor=!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.color).getCheckedState()&&!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.blackWhite).getCheckedState();var noResults=noLicense||noCat||noColor||noPhoto;if(noResults){if(!$("noSearchResultsWarningWindow")){var sbCoords=CorbisUI.DomCache.get("SearchBuddy").getCoordinates();var sbScroll=$(document.body).getScroll();var scrollOffset=sbCoords.top+sbScroll.y;var vPos=noCat?10:noLicense?98:noPhoto?232:287;vPos+=scrollOffset;new CorbisUI.Popup("noSearchResultsWarning",{createFromHTML:true,showModalBackground:false,centerOverElement:"noSearchResultsWarning",closeOnLoseFocus:true,positionVert:vPos,positionHoriz:212,replaceText:[""]});setTimeout(setErrorOptions,100);}return false;}else{MochaUI.CloseModal("noSearchResultsWarning");return true;}}}function setErrorOptions(){var pop=$("noSearchResultsWarningWindow");if(!pop){return false;}var items={license:pop.getElement("p[textKey=License]"),category:pop.getElement("p[textKey=Category]"),color:pop.getElement("p[textKey=Color]"),photo:pop.getElement("p[textKey=Photo]")};items.license.setStyle("display","none");items.category.setStyle("display","none");items.color.setStyle("display","none");items.photo.setStyle("display","none");if(noCat){items.category.setStyle("display","block");}else{if(noLicense){items.license.setStyle("display","block");}else{if(noColor){items.color.setStyle("display","block");}else{if(noPhoto){items.photo.setStyle("display","block");}}}}CorbisUI.DomCache.get("modalOverlay").addEvent("click",function(){$(this).setStyle("display","none");});CorbisUI.DomCache.get("searchProgIndicator").setStyle("display","none");}function secondTimer(){if(stopSearch){if(timer){window.clearInterval(timer);}if(timer2){window.clearInterval(timer2);}stopSearch=false;return;}if(timer2!=null){window.clearInterval(timer);}timer2=window.setInterval("window.clearInterval(timer2);invokeSearch(true)",1500);CorbisUI.DomCache.get("searchProgIndicator").setStyles({display:"block",height:document.body.scrollHeight+"px",left:"206px"});$("processingFilters").setStyle("display","block");}function noPeopleChanged(chk){if(window.location.href.toLowerCase().contains("searchresults.aspx")){var checked=CorbisUI.ImageCb.getImageCbObject(chk).getCheckedState();$("divNoPeopleIcon").setStyle("background-position",checked?"bottom right":"top right");}}function subscriptionOnlyChanged1(chk,inSearchBuddy){var checked=CorbisUI.ImageCb.getImageCbObject(chk).getCheckedState();var value=(checked)?"center -43px":"center -23px";var itemToGet=(inSearchBuddy)?$("SearchBuddy").getElement("div.searchBuddy_subscription"):$("subscriptionIcon");itemToGet.setStyle("background-position",value);}function EditorialChanged(checked){var checks=$("EditorialChildren").getElements("div.imageCheckbox");checks.each(function(cb){CorbisUI.ImageCb.getImageCbObject(cb).setCheckState(checked,false);});}function openCreateLightbox(){if(!CorbisUI.GlobalVars.SearchResults.isAnonymous){new CorbisUI.Popup("createLightboxModalPopup",{showModalBackground:false,centerOverElement:"SearchBuddy",closeOnLoseFocus:true,positionVert:"60",positionHoriz:"5"});var SB=CorbisUI.DomCache.get("SearchBuddy");$("createLightboxModalPopupWindow").setStyles({top:SB.offsetTop+window.getScroll().y+60,left:SB.offsetLeft+window.getScroll().x+5});var clmpw=$("createLightboxModalPopup");var group=new Hash({mo:$("modalOverlay"),close:clmpw.getElement("div.ModalTitleBar input.Close"),cancel:$(CorbisUI.GlobalVars.CreateLightbox.cancelButtonID)});closeLightboxEvent=CloseCreateLightbox.bindWithEvent(clmpw,group);group.each(function(value,key,hash){hash.get(key).addEvent("click",closeLightboxEvent);});ResizeModal("createLightboxModalPopup");setTimeout("$(CorbisUI.GlobalVars.CreateLightbox.newLightboxName).focus();$(CorbisUI.GlobalVars.CreateLightbox.newLightboxName).select();",500);}}function CloseCreateLightbox(e,grp){var validationSummary=this.getElement(".ValidationSummary");if(validationSummary!=null){validationSummary.setStyle("display","none");}var newNameField=this.getElement("input[type=text]");newNameField.value="";newNameField.setStyle("color","#333333");grp.each(function(value,key,hash){hash.get(key).removeEvent("click",closeLightboxEvent);});grp=$lambda(false);}function createLightbox_success(){if(CorbisUI.Handlers.Lightbox.corbisIdToAdd){CorbisUI.Handlers.Lightbox.addTo(CorbisUI.Handlers.Lightbox.corbisIdToAdd);CorbisUI.DomCache.get("lightboxProgress").setStyle("display","none");CorbisUI.Handlers.Lightbox.corbisIdToAdd=null;}CorbisUI.DomCache.get(["LBXContainer","SBBX_lightboxes"],true);}function confirmItemAdded(link){new CorbisUI.Popup("addToCartConfirm",{createFromHTML:true,showModalBackground:false,centerOverElement:link,closeOnLoseFocus:true,positionVert:"top",positionHoriz:"center",replaceText:[]});return false;}function OpenAmbiguousModal(element){new CorbisUI.Popup("ambiguousModal");setGlassButtonDisabled(CorbisUI.GlobalVars.SearchResults.clarificationUpdate,true);ResizeModal("ambiguousModal");}function applyZeroResultsStyles(){CorbisUI.DomCache.get("FooterContent").addClass("zeroResults");CorbisUI.DomCache.get("SearchBuddy").addClass("zeroResultsBuddy");}function updateClarificationCount(isChecked){(isChecked)?_clarifyCheckCount++:_clarifyCheckCount--;setGlassButtonDisabled(CorbisUI.GlobalVars.SearchResults.clarificationUpdate,_clarifyCheckCount<1);}function getClarifactionChecked(method){var base=$("ambiguousModal");var clarificationGroups=base.getElements(".Clarification");var clarificationString="";clarificationGroups.each(function(el){clarificationString+=",";el.getElements(".checkboxWrap").each(function(itemEl){var cbx=itemEl.getElement("input[type=checkbox]");(cbx.checked)?cbx.value=1:cbx.value=0;clarificationString+=cbx.value;});});clarificationString=clarificationString.substring(1);var queryFlags=$(CorbisUI.GlobalVars.SearchResults.clarificationQueryFlags);queryFlags.value=clarificationString;if(method=="cancel"){HideModal("ambiguousModal");}else{MochaUI.CloseModal("ambiguousModal");return clarificationString;}}function SuggestedKeySearch(SearchUrl){if(SearchUrl!=""){CorbisUI.ExtendedSearch.vars._isSearching=true;CorbisUI.ExtendedSearch.ShowSearchProgIndicator();LogOmnitureEvent("event44");location.href=SearchUrl;}}var Floater;if(typeof(CorbisUI)=="undefined"){CorbisUI={};}CorbisUI.SearchBuddy={init:new Class({tabs:null,buddy:null,activeWindow:null,activeTab:null,initialize:function(){this.buddy=CorbisUI.DomCache.get("SearchBuddy");this.tabs=new Hash({});var tabItems=this.buddy.getElement("ul.SB_tabs").getChildren();tabItems.each(function(el){var id=el.get("id");id=id.substr(id.indexOf("SBT_"));id=id.replace("SBT_","");switch(id){case"filters":case"lightboxes":case"quickpic":case"subscriptions":this.tabs.set(id,new CorbisUI.SearchBuddy.tab(el,this));break;}},this);CorbisUI.SearchBuddy.activateTab=this.activateTab.bind(this);},activateTab:function(tabName){if(this.activeTab!=tabName){this.tabs.each(function(item){if(item.name==tabName){item.el.fireEvent("click");}});}}}),activateTab:null,fireLightboxEvent:function(ele){var el=$(ele).getParent().getParent().getParent();var lbId=el.get("id").replace("cartBlock_","LBX_");if(!$(lbId)){var lbItem=el.getElement("div.thumbWrap").getFirst().getFirst().getFirst().clone().removeProperties("title","class");lbItem.setProperty("id",lbId).setStyles({"float":"left",clear:"both",margin:4});var lb=CorbisUI.SearchBuddy.init.tabs.get("lightboxes");lb.el.fireEvent("click");lb.panel.getElement("div.LBXContainer").grab(lbItem,"top");}},tab:new Class({name:null,el:null,buddy:null,panel:null,dataLoaded:false,initialize:function(el,buddy){this.el=el;this.name=el.get("id").substr(el.get("id").indexOf("SBT_")+4);this.buddy=buddy;this.panel=CorbisUI.DomCache.get("SBBX_"+this.name);this.el.addEvent("click",this.clickEvent.bindWithEvent(this));if(this.el.hasClass("SBT_"+this.name+"_ON")){this.buddy.activeTab=this.name;}},clickEvent:function(){if(!Corbis.Web.UI.SearchOld){setTimeout("CorbisUI.SearchBuddy.init.tabs[CorbisUI.SearchBuddy.init.activeTab].clickEvent();",1000);return;}if(this.buddy.activeTab!=this.name){var active=this.buddy.tabs.get(this.buddy.activeTab);active.el.removeClass("SBT_"+this.buddy.activeTab+"_ON");active.panel.addClass("hdn");this.buddy.activeTab=this.name;this.el.addClass("SBT_"+this.name+"_ON");this.panel.removeClass("hdn");if(this.name=="lightboxes"&&!this.dataLoaded){if(CorbisUI.GlobalVars.SearchResults.isAnonymous){$("lightboxProgress").setStyle("display","none");CorbisUI.DomCache.get("LBXContainer").getElement(".centerMe").setStyle("display","block");}else{this.dataLoaded=true;var selectedList=CorbisUI.DomCache.get("SBBX_lightboxes",true).getElement("select.lightboxList");if(selectedList!=null&&selectedList.getSelected()[0]!=null){var selectedIndex=selectedList.selectedIndex;var lightboxId=selectedList.options[selectedIndex].value;CorbisUI.Handlers.Lightbox.getLightboxItems(lightboxId);}}}if(this.name=="subscriptions"&&!this.dataLoaded){this.dataLoaded=true;CorbisUI.Handlers.Subscription.getSubscriptionItems();}}}}),floater:new Class({box:null,boxOffsetHeight:null,wrap:null,footer:null,progressContainer:null,progressLoader:null,initialize:function(el,wrap,footer,progressContainer){this.box=el;this.wrap=wrap;this.footer=footer;this.progressContainer=progressContainer;var wC=this.wrap.getCoordinates();this.box.setStyles({top:wC.top+10});this.boxOffsetHeight=this.box.offsetHeight;this.wC={top:wC.top,bottom:wC.top+wC.height};window.addEvent("scroll",this.windowScroll.bindWithEvent(this));window.addEvent("resize",this.windowScroll.bindWithEvent(this));this.windowScroll();},windowScroll:function(){HideModal("createLightboxModalPopup");var wScroll=window.getScroll();var pos=this.wrap.getPosition();var wrapC=this.wrap.getCoordinates();var fC=this.footer.getCoordinates();var wiC=window.getCoordinates();(wScroll.x>0)?this.box.setStyle("left","-"+wScroll.x+"px"):this.box.setStyle("left",0);if(wScroll.y<this.wC.top){this.box.setStyle("top",(pos.y-wScroll.y)+10);}else{if((wScroll.y+wiC.height)>fC.top){if(this.boxOffsetHeight>wiC.height){this.box.setStyle("top",fC.top-(wScroll.y+wiC.height)-(this.boxOffsetHeight-wiC.height)-10);}else{this.box.setStyle("top",fC.top-(wScroll.y+wiC.height));}}else{if(this.box.getStyle("top").toInt()!=10){this.box.setStyle("top",10);}}}var fCheck=fC.top-wiC.height;if(wScroll.y>fCheck){this.box.setStyle("bottom",(wiC.height-(fC.top-wScroll.y))+10);}else{if(this.box.getStyle("bottom").toInt()!=-50){this.box.setStyle("bottom",10);}}var browser=navigator.appName;var b_version=navigator.appVersion;var version=parseFloat(b_version);if((browser=="Microsoft Internet Explorer")&&(version<=7)){var lbxContainerHeight;var distance=160;var fixMe=0;if(wScroll.y>fCheck){distance=155;}lbxContainerHeight=this.box.getStyle("height").toInt()-distance;CorbisUI.DomCache.get("LBXContainer").setStyle("height",lbxContainerHeight);}}}),floater_ieSIX:new Class({box:null,wrap:null,footer:null,progressContainer:null,progressLoader:null,initialize:function(el,wrap,footer,progressContainer){this.box=el;this.wrap=wrap;this.footer=footer;this.progressContainer=progressContainer;var wC=this.wrap.getCoordinates();this.box.getElement("div.inSearchBuddy").setStyle("position","relative");this.box.setStyles({"margin-top":10});this.box.setStyle("position","absolute");this.box.setStyle("display","block");this.SBBXF=this.box.getElement("div.SBBX_filters");this.SBBXL=this.box.getElement("div.SBBX_lightboxes");this.SBBXS=this.box.getElement("div.SBBX_subscriptions");this.SBBXQ=this.box.getElement("div.SBBX_quickpic");if(this.SBBXQ){var QPC=this.box.getElement("div.quickPicsContainer");QPC.setStyle("overflow","scroll");}var LBXC=this.box.getElement("div.LBXContainer");LBXC.setStyle("overflow","scroll");var boxHeight=window.getCoordinates().height-this.wrap.getCoordinates().top;this.box.setStyle("height",boxHeight);this.SBBXL.setStyle("height",boxHeight);if(this.SBBXF){this.SBBXF.setStyle("height",boxHeight+200);}if(this.SBBXQ){this.SBBXQ.setStyle("height",boxHeight);}LBXC.setStyle("height",boxHeight-(LBXC.getCoordinates(this.box).top));if(this.SBBXQ){QPC.setStyle("height",boxHeight-(LBXC.getCoordinates(this.box).top));}this.wC={top:wC.top,bottom:wC.top+wC.height};window.addEvent("scroll",this.windowScroll.bindWithEvent(this));window.addEvent("resize",this.windowScroll.bindWithEvent(this));this.windowScroll();},windowScroll:function(){HideModal("createLightboxModalPopup");var LBXC=this.box.getElement("div.LBXContainer");var wScroll=window.getScroll();var pos=this.wrap.getPosition();var wrapC=this.wrap.getCoordinates();var fC=this.footer.getCoordinates();var wiC=window.getCoordinates();(wScroll.x>0)?this.box.setStyle("left","-"+wScroll.x+"px"):this.box.setStyle("left",0);if(wScroll.y<this.wC.top){var boxHeight=0;this.box.setStyles({"margin-top":10});boxHeight=(wiC.height-(wrapC.top-wScroll.y))+20;if(boxHeight>=0){this.box.setStyle("height",boxHeight);}boxHeight=wiC.height-(wrapC.top-wScroll.y);if(boxHeight>=0){this.SBBXL.setStyle("height",boxHeight);}boxHeight=boxHeight-(LBXC.getCoordinates(this.box).top);if(boxHeight>=0){LBXC.setStyle("height",boxHeight);}}else{if((wScroll.y+wiC.height)>fC.top){}else{this.box.setStyles({"margin-top":((wScroll.y-wrapC.top)+10),height:wiC.height-10});var boxHeight=wiC.height-10;this.SBBXL.setStyle("height",boxHeight+60);LBXC.setStyle("height",boxHeight+30);}}var fCheck=fC.top-wiC.height;if(wScroll.y>fCheck){this.box.setStyle("bottom",(wiC.height-(fC.top-wScroll.y))+10);}else{if(this.box.getStyle("bottom").toInt()!=-50){this.box.setStyle("bottom",10);}}var browser=navigator.appName;var b_version=navigator.appVersion;var version=parseFloat(b_version);if((browser=="Microsoft Internet Explorer")&&(version<=7)){var lbxContainerHeight;var distance=160;var fixMe=0;if(wScroll.y>fCheck){distance=155;}lbxContainerHeight=this.box.getStyle("height").toInt()-distance;var container=CorbisUI.DomCache.get("LBXContainer",true);if(lbxContainerHeight>0){CorbisUI.DomCache.get("LBXContainer",true).setStyle("height",lbxContainerHeight+"px");}}}}),getValidateAlertPosition:function(el){var coords=$(el).getCoordinates();var filterErrorHeight=CorbisUI.DomCache.get("filterErrorWindow").getCoordinates().height;var scroll=$(document.body).getScroll();var position=coords.top+scroll.y-filterErrorHeight+75;if(Browser.Engine.webkit){position=position-182;}if(position<scroll.y){position=scroll.y+5;}return position;},validateCheckBoxes:function(){CorbisUI.DomCache.get("filterErrorCategories").setStyle("display","none");CorbisUI.DomCache.get("filterErrorColor").setStyle("display","none");CorbisUI.DomCache.get("filterErrorPhotography").setStyle("display","none");CorbisUI.DomCache.get("filterErrorRMRF").setStyle("display","none");if(!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.creative).getCheckedState()&&!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.editorial).getCheckedState()){CorbisUI.DomCache.get("filterErrorCategories").setStyle("display","block");new CorbisUI.Popup("filterError",{showModalBackground:false,closeOnLoseFocus:true});ResizeModal("filterError");CorbisUI.DomCache.get("filterErrorWindow").setStyles({left:185,top:this.getValidateAlertPosition(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.editorial)});return false;}if(!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.photography).getCheckedState()&&!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.illustration).getCheckedState()){CorbisUI.DomCache.get("filterErrorPhotography").setStyle("display","block");new CorbisUI.Popup("filterError",{showModalBackground:false,closeOnLoseFocus:true});ResizeModal("filterError");CorbisUI.DomCache.get("filterErrorWindow").setStyles({left:185,top:this.getValidateAlertPosition(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.photography)});return false;}if(!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.color).getCheckedState()&&!CorbisUI.ImageCb.getImageCbObject(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.blackWhite).getCheckedState()){CorbisUI.DomCache.get("filterErrorColor").setStyle("display","block");new CorbisUI.Popup("filterError",{showModalBackground:false,closeOnLoseFocus:true});ResizeModal("filterError");CorbisUI.DomCache.get("filterErrorWindow").setStyles({left:185,top:this.getValidateAlertPosition(CorbisUI.GlobalVars.SearchResults.checkBoxIDS.color)});return false;}return true;},lightboxLogin:function(){CorbisUI.Auth.Check(1,"execute","CorbisUI.SearchBuddy.lightboxLogin_cookieEvent()");},lightboxLogin_cookieEvent:function(){CorbisUI.CookieEvents.addCookieEvent(function(){setTimeout("CorbisUI.SearchBuddy.activateTab('lightboxes')",500);},{});window.location.reload();}};CorbisUI.addQueueItem("domReady","searchBuddySetup",function(){CorbisUI.SearchBuddy.init=new CorbisUI.SearchBuddy.init();var buddyVersion=(Browser.Engine.trident4)?"floater_ieSIX":"floater";Floater=new CorbisUI.SearchBuddy[buddyVersion](CorbisUI.DomCache.get("SearchBuddy"),CorbisUI.DomCache.get("contentBar"),CorbisUI.DomCache.get("FooterContent"));});if(typeof(CorbisUI)=="undefined"){CorbisUI={};}CorbisUI.Cart={};var addToCartVar=null;CorbisUI.Cart.AddToCartInst=function(){if(!addToCartVar){addToCartVar=new CorbisUI.Cart.AddToCart();}return addToCartVar;};CorbisUI.Cart.AddToCart=new Class({context:null,offeringUid:null,onSuccess:$empty,initialize:function(offeringUid){this.offeringUid=offeringUid;Corbis.Web.UI.Checkout.CartScriptService.set_defaultUserContext(this);},addRFCDToCart:function(el){if(!CorbisUI.Pricing.IsAuthenticated(el.id)){return false;}return true;},addOfferingToCart:function(){LogOmnitureEvent("scAdd");Corbis.Web.UI.Checkout.CartScriptService.AddOfferingToCart(this.offeringUid,this.addOfferingToCartSuccess,this.methodFailed);},addProductToCart:function(corbisId,productUid){LogOmnitureEvent("scAdd");Corbis.Web.UI.Checkout.CartScriptService.AddProductToCart(corbisId,productUid,this.addOfferingToCartSuccess,this.methodFailed);},displaySuccessDialog:function(context){var options={createFromHTML:false,showModalBackground:false,closeOnLoseFocus:true,positionVert:"top",positionHoriz:-250};if(context&&$type(context.CT)=="element"){options.centerOverElement=context.CT;}new CorbisUI.Popup("addToCartConfirm",options);$("addToCartConfirmWindow").getElement("input.Close").setStyle("visibility","visible");},addOfferingToCartSuccess:function(results,context,methodName){if(results>0){context.onSuccess(results);}else{}},methodFailed:function(results,context,methodName){alert(results.get_message());}});
