//\///// //\ overLIB Anchor Plugin //\ This file requires overLIB 4.00 or later. //\ //\ overLIB 4.05 - You may not remove or change this notice. //\ Copyright Erik Bosrup 1998-2004. All rights reserved. //\ Contributors are listed on the homepage. //\ See http://www.bosrup.com/web/overlib/ for details. //\///// if (typeof olInfo=='undefined'||olInfo.simpleversion<400) alert('overLIB 4.00 or later is required for the Anchor Plugin.');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-1||o3_relx!=null) { placeX=(o3_relx!=null?( o3_relx<0?winoffset+o3_relx+iwidth-parsedWidth-widthFix:winoffset+o3_relx):o3_fixx);} else { if (o3_hauto==1) {if ((o3_x-winoffset)>(iwidth/2)) {o3_hpos=LEFT;} else {o3_hpos=RIGHT;} } if (o3_hpos==CENTER) {placeX=o3_x+o3_offsetx-(parsedWidth/2); if (placeX(winoffset+iwidth-widthFix)) {placeX=iwidth+winoffset-parsedWidth-widthFix;if (placeX<0) placeX=0;} } if (o3_hpos==LEFT) {placeX=o3_x-o3_offsetx-parsedWidth;if (placeX1) {var snapping=placeX % o3_snapx; if (o3_hpos==LEFT) {placeX=placeX-(o3_snapx+snapping);} else { placeX=placeX+(o3_snapx-snapping);} if (placeX-1||o3_rely!=null) { placeY=(o3_rely!=null?(o3_rely<0?scrolloffset+o3_rely+iheight-parsedHeight:scrolloffset+o3_rely):o3_fixy);} else { if (o3_vauto==1) {if ((o3_y-scrolloffset)>(iheight/2)) {o3_vpos=ABOVE;} else {o3_vpos=BELOW;} } if (o3_vpos==ABOVE) {if (o3_aboveheight==0) o3_aboveheight=parsedHeight; placeY=o3_y-(o3_aboveheight+o3_offsety);if (placeY1) {var snapping=placeY % o3_snapy; if (o3_aboveheight>0&&o3_vpos==ABOVE) {placeY=placeY-(o3_snapy+snapping);} else {placeY=placeY+(o3_snapy-snapping);} if (placeY1) {mkObj=mlyr[0] offsets[0]+=mlyr[0].x+mlyr[1].pageX offsets[1]+=mlyr[0].y+mlyr[1].pageY } else {if(mlyr.toString().indexOf('Image')!=-1||mlyr.toString().indexOf('Anchor')!=-1){offsets[0]+=mlyr.x offsets[1]+=mlyr.y } else {offsets[0]+=mlyr.pageX offsets[1]+=mlyr.pageY } } } else {offsets[0]+=pageLocation(mlyr, 'Left') offsets[1]+=pageLocation(mlyr, 'Top') } of=getAnchorOffsets(mkObj) if (typeof o3_dragimg!='undefined'&& o3_dragimg) {olImgLeft=offsets[0];olImgTop=offsets[1];} offsets[0]+=of[0] offsets[1]+=of[1] if (typeof o3_dragimg!='undefined'&& o3_dragimg) {olImgRight=offsets[0];olImgBottom=offsets[1];return;} return offsets;} function getAnchorOffsets(mkObj){var fx=fy=0, mp, puc, mkAry, sx=sy=0, w=o3_anchoralign var mW=mH=pW=pH=0 var off=[0, 0] mkAry=w.split(','); if (mkAry.length<3) {mp=mkAry[0].toUpperCase();puc=(mkAry.length==1)?mp:mkAry[1].toUpperCase();} else if (mkAry.length==3) {if (!isNaN(mkAry[0])) {mp=mkAry.slice(0, 2);puc=mkAry[2].toUpperCase();} else {mp=mkAry[0].toUpperCase();puc=mkAry.slice(1);} } else {mp=mkAry.slice(0, 2);puc=mkAry.slice(2);} var shdwPresent=typeof o3_shadow!='undefined'&& o3_shadow if (shdwPresent) {sx=Math.abs(o3_shadowx);sy=Math.abs(o3_shadowy);} pW=(shdwPresent?parseInt(o3_width):(olNs4?over.clip.width:over.offsetWidth)) pH=(shdwPresent?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight)) if (olOp&& o3_wrap) {pW=(shdwPresent?parseInt(o3_width):(olNs4?over.clip.width:over.offsetWidth)) pH=(shdwPresent?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight)) } if (!olOp&& mkObj.toString().indexOf('Image')!=-1){mW=mkObj.width mH=mkObj.height } else if (!olOp&& mkObj.toString().indexOf('Anchor')!=-1) {mp='UL' } else {mW=(olNs4)?mkObj.clip.width:mkObj.offsetWidth mH=(olNs4)?mkObj.clip.height:mkObj.offsetHeight } if (!isNaN(mp)||typeof mp=='object') {if (typeof mp=='object') {fx=parseFloat(mp[0]);fy=parseFloat(mp[1]);} else fx=fy=parseFloat(mp);off=[Math.round(fx*mW), Math.round(fy*mH)];} else {if (mp=='UR') off=[mW, 0] else if (mp=='LL') off=[0, mH] else if (mp=='LR') off=[mW, mH] } if (typeof o3_dragimg!='undefined'&& o3_dragimg) return off;else {if (!isNaN(puc)||typeof puc=='object' ) {if (typeof puc=='object') {fx=parseFloat(puc[0]);fy=parseFloat(puc[1]);} else fx=fy=parseFloat(puc);off[0]-=Math.round(fx*(pW-sx));off[1]-=Math.round(fy*(pH-sy));} else {if (puc=='UR') {off[0]-=(pW-sx);off[1]-=sy } else if (puc=='LL') {off[0]-=sx;off[1]-=(pH-sy) } else if (puc=='LR') {off[0]-=(pW-sx);off[1]-=(pH-sy) } } return off } } function pageLocation(o, t){var x=0 while(o.offsetParent){x+=o['offset'+t] o=o.offsetParent } x+=o['offset'+t] return x } function getRefById(l, d){var r="", j d=(d||document) if (d.all) return d.all[l] else if (d.getElementById) return d.getElementById(l) else if (d.layers&& d.layers.length>0) {if (d.layers[l]) return d.layers[l] for (j=0; j0) {for (j=0; j0) return r else if (r) return [r, d.layers[j]] } } return null } registerHook("placeLayer", anchorPlaceLayer, FREPLACE);registerRunTimeFunction(setAnchorVariables);registerCmdLineFunction(parseAnchorExtras);registerPostParseFunction(checkAnchorObject);registerHook("createPopup", anchorPreface, FAFTER);