var isWindowSmall=0;var heightDelta=0;var clipTestNotFound=0;Object.extend(Element,{centerElement:function(d,e){var c=document.createElement("div");var b=document.createElement("div");var a=document.createElement("div");Element.addClassName(c,"divImageCenter1");Element.addClassName(b,"divImageCenter2");Element.addClassName(a,"divImageCenter3");c.appendChild(b);b.appendChild(a);a.appendChild(d);e.appendChild(c);return c}});ClipObjectPrototype=Class.create();ClipObjectPrototype.prototype={initialize:function(){},init_requirements:function(c){for(var b in c){this[b]=c[b]}var a=true;for(var b in this.required){if(typeof(c[b])=="undefined"){alert('Missing required parameter: "'+b+'" - '+this.required[b]);a=false}}return a}};ClipImage=Class.create();ClipImage.prototype=Object.extend(new ClipObjectPrototype,{objectname:"ClipImage",initialize:function(c){this.required={parent:"object who owns ClipImage",parentDiv:"div to create clip divs/images in",index:"index in the parent object",url:"url of the clip",serverName:"the url context path",pageIndex:"page index on the server",width:"max width of the clip",height:"max height of the clip",clickCallback:"function(event, this) to be called when an image is clicked",loadCallback:"function(event, this) to be called when an image is clicked"};this.keepLoading=0;if(typeof(c)=="undefined"){return false}if(this.init_requirements(c)==false){return false}var a=(!(typeof(c.clickable)!="undefined"&&c.clickable==false));this.clipdiv=document.createElement("div");if(a){Element.addClassName(this.clipdiv,"clickable")}Element.addClassName(this.clipdiv,"clip-view-toplevel");if(a){Element.addClassName(this.clipdiv,"cursor")}this.clipdiv.style.position="absolute";this.clipdiv.style.overflow="hidden";this.clipdiv.style.width=getScreenWidth()-20;this.clipdiv.style.height=this.height;this.parentDiv.appendChild(this.clipdiv);var b=this;if(a){Event.observe(this.clipdiv,"click",function(d){return b.clickCallback.call(b,d,b)})}if(this.notFound==true){this.showNotFound()}else{if(this.loadingOnly==true){this.showLoading()}else{this.loadClip()}}},loadClip:function(){this.showLoading();var a=this;this.image=document.createElement("img");Event.observe(this.image,"load",this.onLoad.bindAsEventListener(this));this.image.setAttribute("src",this.url)},onLoad:function(a){if(clipTestNotFound||(this.image.width==150&&this.image.height==60)){this.status="notfound";if(this.keepLoading!=1){this.showNotFound()}}else{this.status="complete";this.reset();Element.centerElement(this.image,this.clipdiv)}this.loadCallback(a,this)},showLoading:function(){var a=_gl_getMessage("CIT.IMG_DIR");this.status="loading";this.textMessage("")},showNotFound:function(){this.status="notfound";this.textMessage("["+_gl_getMessage("PAT_TICLIPS_NO_DRW_FOUND")+"...]")},textMessage:function(b){this.reset();var a=document.createElement("div");Element.addClassName(a,"clip-message");Element.update(a,b);Element.centerElement(a,this.clipdiv)},reset:function(){Element.update(this.clipdiv,"")}});ClipObject=Class.create();ClipObject.prototype=Object.extend(new ClipObjectPrototype,{objectname:"ClipObject",initialize:function(a){this.required={divElement:"DIV Element the clip object lives in",documentNumber:"Number of the patent document",derwentSubscription:"Boolean for derwent subscription",daysValid:"# of days the link is valid",date:"YYYYMMDD format for the current date",hash:"Generated hash, see description in documentation"};this.zoomWindowWidth=450;this.zoomWindowHeight=650;this.zoomClipWidth=400;this.zoomClipHeight=500;this.pageIndex=0;if(typeof(a)=="undefined"){return false}if(this.init_requirements(a)==false){return false}this.populateDiv();Event.observe(window,"resize",this.resize.bindAsEventListener(this),false);return true},resize:function(a){},populateDiv:function(){},imageCount:function(){return 1},populateDiv:function(){Element.update(this.divElement,"");this.resize();this.createBanner();this.resize();this.clipDiv=document.createElement("div");this.clipDiv.style.width=getScreenWidth()-20;this.clipDiv.style.height=this.clipDivHeight;this.divElement.appendChild(this.clipDiv);this.singleClip=new ClipImage({parent:this,parentDiv:this.clipDiv,serverName:this.serverName,index:1,url:this.imageURL(this.documentNumber),pageIndex:1,width:this.clipDivWidth,height:this.clipDivHeight,keepLoading:1,loadingOnly:true,clickCallback:function(){},loadCallback:function(){}});var b=this.ajax+this.drawingInfoURL+"?patent="+this.documentNumber+"&size="+this.clipDivWidth+"&derwent="+this.derwentSubscription;var a=new Ajax.Request(b,{method:"get",onComplete:this.drawingInfoComplete.bindAsEventListener(this)})},createContentDiv:function(){this.divElement=document.createElement("div");Element.addClassName(this.divElement,"clip-thumbnail-view");this.parent.divElement.appendChild(this.divElement);this.resize()},resize:function(a){this.dimensions=Element.getDimensions(this.divElement);if(typeof(this.banner)!="undefined"){this.banner.resize(a);this.clipDivHeight=this.dimensions.height-this.banner.dimensions.height;this.clipDivWidth=this.dimensions.width-20}},imageLoad:function(d,c){if(c.status=="notfound"){var b=this.ajax+this.drawingInfoURL+"?patent="+this.documentNumber+"&size="+this.clipDivWidth+"&derwent="+this.derwentSubscription;var a=new Ajax.Request(b,{method:"get",onComplete:this.drawingInfoComplete.bindAsEventListener(this)})}else{this.clipList=new Array();this.clipList.push(this.singleClip.url);this.banner.updateCount(1)}},drawingInfoComplete:function(b){var a=0;$A(b.responseXML.getElementsByTagName("error")).each(function(e){a=1});if(a==1){this.singleClip.textMessage("["+_gl_getMessage("PAT_TICLIPS_LOADING_ERROR")+"]")}else{this.clipList=new Array();var d=$A(b.responseXML.getElementsByTagName("doc"));var c=this;d.each(function(e){c.clipList.push(e)});this.loadRowView()}},clipCount:function(){if(typeof(this.clipList)=="undefined"){return 0}if(this.clipList.length>0){return this.clipList.length}return 0},imageURL:function(a){return this.image+this.clipURL+"/"+this.hash+"/"+this.clipDivWidth+"/"+this.daysValid+"/"+this.date+"/"+a+".png?derwent="+this.derwentSubscription}});ClipThumbnails=Class.create();ClipThumbnails.prototype=Object.extend(new ClipObject,{objectname:"ClipThumbnails",createBanner:function(){this.banner=new ClipThumbnailBanner({parent:this,onChange:this.viewChange.bindAsEventListener(this)})},imageClick:function(b,a){var c=new ClipThumbnailContainer();c.parent=this;c.zoom(this.documentNumber,a.pageIndex)},loadRowView:function(){this.banner.updateCount(this.clipCount());Element.update(this.clipDiv,"");this.rows=new ClipRows({parent:this,parentDiv:this.clipDiv,clipList:this.clipList,height:this.clipDivHeight,width:this.clipDivWidth})},loadStackedView:function(){this.banner.updateCount(this.clipCount());Element.update(this.clipDiv,"");this.stacked=new ClipStacked({parent:this,parentDiv:this.clipDiv,clipList:this.clipList,height:this.clipDivHeight,width:this.clipDivWidth})},viewChange:function(a){if(typeof(this.clipList)=="undefined"||this.clipCount()<=1){return}if(this.banner.view()=="row"){this.loadRowView()}else{this.loadStackedView()}}});ClipThumbnailBanner=Class.create();ClipThumbnailBanner.prototype=Object.extend(new ClipObjectPrototype,{objectname:"ClipThumbnailBanner",initialize:function(b){this.required={parent:"A reference to the main ClipObject",onChange:"reference to a function which handles view change events"};if(this.init_requirements(b)==false){return false}var a=this.parent.divElement;this.divElement=document.createElement("div");Element.addClassName(this.divElement,"clip-banner");this.parent.divElement.appendChild(this.divElement);Element.update(this.divElement,'
'+_gl_getMessage("PAT_TICLIPS_IMAGES")+'() | '+_gl_getMessage("PAT_TICLIPS_VIEW_IN")+': |