if(typeof olInfo=="undefined"||typeof olInfo.meets=="undefined"||!olInfo.meets(4.1)){alert("overLIB 4.10 or later is required for the Anchor Plugin.")}else{registerCommands("anchor,anchorx,anchory,noanchorwarn,anchoralign");if(typeof ol_anchor=="undefined"){var ol_anchor=""}if(typeof ol_anchorx=="undefined"){var ol_anchorx=0}if(typeof ol_anchory=="undefined"){var ol_anchory=0}if(typeof ol_noanchorwarn=="undefined"){var ol_noanchorwarn=1}if(typeof ol_anchoralign=="undefined"){var ol_anchoralign="UL"}var o3_anchor="";var o3_anchorx=0;var o3_anchory=0;var o3_noanchorwarn=1;var o3_anchoralign="UL";var mrkObj,rmrkPosition;function setAnchorVariables(){o3_anchor=ol_anchor;o3_anchorx=ol_anchorx;o3_anchory=ol_anchory;o3_noanchorwarn=ol_noanchorwarn;o3_anchoralign=ol_anchoralign;mrkObj=null}function parseAnchorExtras(pf,i,ar){var v,k=i;if(k<ar.length){if(ar[k]==ANCHOR){eval(pf+"anchor = '"+escSglQuote(ar[++k])+"'");return k}if(ar[k]==ANCHORX){eval(pf+"anchorx = "+ar[++k]);return k}if(ar[k]==ANCHORY){eval(pf+"anchory = "+ar[++k]);return k}if(ar[k]==NOANCHORWARN){eval(pf+"noanchorwarn = ("+pf+"noanchorwarn==1) ? 0 : 1");return k}if(ar[k]==ANCHORALIGN){k=opt_MULTIPLEARGS(++k,ar,(pf+"anchoralign"));return k}}return -1}function checkAnchorObject(){var a=o3_anchor;if(a){if(!(mrkObj=getAnchorObjectRef(a))){if(o3_noanchorwarn){alert('WARNING!  Reference mark "'+a+'" not found.');return false}else{a=""}}}return true}function anchorHorizontal(c,d,a){var b=(typeof o3_anchor!="undefined"&&o3_anchor);if(!b){return void (0)}if(typeof o3_followscroll!="undefined"&&o3_followscroll&&o3_sticky){o3_relx=rmrkPosition[0]}return rmrkPosition[0]}function anchorVertical(b,a){var c=(typeof o3_anchor!="undefined"&&o3_anchor);if(!c){return void (0)}if(typeof o3_followscroll!="undefined"&&o3_followscroll&&o3_sticky){o3_rely=rmrkPosition[1]}return rmrkPosition[1]}function anchorPreface(){if(!mrkObj){return}rmrkPosition=getAnchorLocation(mrkObj)}function getAnchorObjectRef(a){return getRefById(a,o3_frame.document)||getRefByName(a,o3_frame.document)}function getAnchorLocation(e){var c,d,b,a;c=a=e;b=[o3_anchorx,o3_anchory];if(document.layers){if(typeof a.length!="undefined"&&a.length>1){c=a[0];b[0]+=a[0].x+a[1].pageX;b[1]+=a[0].y+a[1].pageY}else{if(a.toString().indexOf("Image")!=-1||a.toString().indexOf("Anchor")!=-1){b[0]+=a.x;b[1]+=a.y}else{b[0]+=a.pageX;b[1]+=a.pageY}}}else{b[0]+=pageLocation(a,"Left");b[1]+=pageLocation(a,"Top")}d=getAnchorOffsets(c);if(typeof o3_dragimg!="undefined"&&o3_dragimg){olImgLeft=b[0];olImgTop=b[1]}b[0]+=d[0];b[1]+=d[1];if(typeof o3_dragimg!="undefined"&&o3_dragimg){olImgRight=b[0];olImgBottom=b[1];return}return b}function getAnchorOffsets(a){var e=fy=0,c,f,i,g=sy=0,j=o3_anchoralign;var d=mH=pW=pH=0;var b=[0,0];i=j.split(",");if(i.length<3){c=i[0].toUpperCase();f=(i.length==1)?c:i[1].toUpperCase()}else{if(i.length==3){if(!isNaN(i[0])){c=i.slice(0,2);f=i[2].toUpperCase()}else{c=i[0].toUpperCase();f=i.slice(1)}}else{c=i.slice(0,2);f=i.slice(2)}}var h=typeof o3_shadow!="undefined"&&o3_shadow;if(h){g=Math.abs(o3_shadowx);sy=Math.abs(o3_shadowy)}pW=(h?parseInt(o3_width):(olNs4?over.clip.width:over.offsetWidth));pH=(h?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight));if(olOp&&o3_wrap){pW=(h?parseInt(o3_width):(olNs4?over.clip.width:over.offsetWidth));pH=(h?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight))}if(!olOp&&a.toString().indexOf("Image")!=-1){d=a.width;mH=a.height}else{if(!olOp&&a.toString().indexOf("Anchor")!=-1){c="UL"}else{d=(olNs4)?a.clip.width:a.offsetWidth;mH=(olNs4)?a.clip.height:a.offsetHeight}}if(!isNaN(c)||typeof c=="object"){if(typeof c=="object"){e=parseFloat(c[0]);fy=parseFloat(c[1])}else{e=fy=parseFloat(c)}b=[Math.round(e*d),Math.round(fy*mH)]}else{if(c=="UR"){b=[d,0]}else{if(c=="LL"){b=[0,mH]}else{if(c=="LR"){b=[d,mH]}}}}if(typeof o3_dragimg!="undefined"&&o3_dragimg){return b}else{if(!isNaN(f)||typeof f=="object"){if(typeof f=="object"){e=parseFloat(f[0]);fy=parseFloat(f[1])}else{e=fy=parseFloat(f)}b[0]-=Math.round(e*(pW-g));b[1]-=Math.round(fy*(pH-sy))}else{if(f=="UR"){b[0]-=(pW-g);b[1]-=sy}else{if(f=="LL"){b[0]-=g;b[1]-=(pH-sy)}else{if(f=="LR"){b[0]-=(pW-g);b[1]-=(pH-sy)}}}}return b}}function pageLocation(c,b){var a=0;while(c.offsetParent){a+=c["offset"+b];c=c.offsetParent}a+=c["offset"+b];return a}function getRefById(a,e){var c="",b;e=(e||document);if(e.all){return e.all[a]}else{if(e.getElementById){return e.getElementById(a)}else{if(e.layers&&e.layers.length>0){if(e.layers[a]){return e.layers[a]}for(b=0;b<e.layers.length;b++){c=getRefById(a,e.layers[b].document);if(c){return c}}}}}return false}function getRefByName(a,e){var c=null,b;e=(e||document);if(e.images[a]){return e.images[a]}else{if(e.anchors[a]){return e.anchors[a]}else{if(e.layers&&e.layers.length>0){for(b=0;b<e.layers.length;b++){c=getRefByName(a,e.layers[b].document);if(c&&c.length>0){return c}else{if(c){return[c,e.layers[b]]}}}}}}return null}registerRunTimeFunction(setAnchorVariables);registerCmdLineFunction(parseAnchorExtras);registerPostParseFunction(checkAnchorObject);registerHook("createPopup",anchorPreface,FAFTER);registerHook("horizontalPlacement",anchorHorizontal,FCHAIN);registerHook("verticalPlacement",anchorVertical,FCHAIN);if(olInfo.meets(4.1)){registerNoParameterCommands("noanchorwarn")}};
