//\/////
//\  coolTip Draggable Plugin
//\  This file requires coolTip 1.00 or later.
//\  Modified July 9, 2006 -- Added DRAGCAP command to allow
//\   dragging by the CAPTION region.  Requires that the
//\   ANCHOR plugin be loaded too.
//\   August 21, 2006 - to be consistent with name change of createPopup routine
//\
//\  You may not remove or change this notice.
//\  Copyright Robert E Boughner 2005. All rights reserved.
//\  
//\  This plugin is governed by the same restrictions set forth
//\  in the prologue to cCore.js.
//\/////
//\  THIS IS A VERY MODIFIED VERSION. DO NOT EDIT OR PUBLISH. GET THE ORIGINAL!
if(typeof cInfo==cUdf||!cInfo.meets(1.00))alert('coolTip 1.00 or later is required for the Draggable Plugin.');else{registerCommands('draggable,dragcap,altcut,dragimg,hidecontent');
setDefaultVariables('draggable|0|dragcap|0|altcut|0|dragimg||hidecontent|0');
var cMseMv,cMseOvr,cOp8=(cOp&&parseFloat(navigator.appVersion)>8.0);
function setDragVariables(obj){obj.draggable=cd_draggable;obj.dragcap=cd_dragcap;obj.beingDragged=0;obj.altcut=cd_altcut;obj.dragimg=cd_dragimg;obj.hidecontent=cd_hidecontent;obj.contentLocation=obj.imgObject=obj.dragObject=null;}
function parseDragExtras(pf,i,ar){var v,k=i;if(k<ar.length){if(ar[k]==DRAGGABLE){eval(pf+'draggable=('+pf+'draggable==0)?1:0');return k;}
if(ar[k]==DRAGCAP){if(pf!='cd_')eval(pf+'draggable=1');eval(pf+'dragcap=('+pf+'dragcap==0)?1:0');return k;}
if(ar[k]==ALTCUT){eval(pf+'altcut=('+pf+'altcut==0)?1:0');return k;}
if(ar[k]==DRAGIMG){eval(pf+'dragimg="'+ar[++k]+'"');return k;}
if(ar[k]==HIDECONTENT){eval(pf+'hidecontent=('+pf+'hidecontent==0)?1:0');return k;}}
return-1;}
function setOverTrip(obj){var pO=obj.pop;if(pO){if(cNs4)obj.captureEvents(Event.MOUSEOVER);obj.onmouseover=function(e){e=(e)?e:event;if(/mouseover/i.test(e.type)&&!this.pop.beingDragged){cTip=this;po=cTip.pop;if(cMseOvr){if(!cNs4)po.hoveringSwitch=true;if(po.timerid>0){clearTimeout(po.timerid);po.timerid=0;}}
if(po.draggable&&!cTip.onmousedown)startDrag();}
if(cNs4)return routeEvent(e);}}}
function startDrag(content){
with(po){if(draggable){if(sticky&&(cFrame==cd_frame)){cMseOvr=(cTip.onmouseover!=null&&/timerid/.test(cTip.onmouseover.toString()));if(!cTip.onmouseover||!/draggable/.test(cTip.onmouseover.toString()))setOverTrip(cTip,cMseOvr);initDrag(cTip);}else draggable=0;}}}
function stopDrag(obj){if(obj.pop.draggable)endDrag(obj);}
function initDrag(obj){cMseMv=capExtent.onmousemove;var po=obj.pop;if(cNs4){obj.captureEvents(Event.MOUSEDOWN|Event.CLICK);obj.onmousedown=grabEl;obj.onclick=function(e){return routeEvent(e);}
}else{obj.onmousedown=grabEl;}
with(po){if(dragimg)chkForImgSupport(dragimg);}
return true;}
function chkForImgSupport(dragImg){if(dragImg){with(po){dragimg=dragImg;if(typeof getAnchorObjRef!=cUdf)imgObject=getAnchorObjRef(dragImg);if(imgObject==null)dragimg='';}}}
function checkBodyImages(content){var obj,objI,objT,tT,rR,cC,kW3C=(document.getElementsByTagName)?1:0;if(!cNs4&&po.draggable){with(po){obj=kW3C?cTip.getElementsByTagName("table"):cTip.tags("table");if(dragcap){tT=((typeof CSSW3C!=cUdf&&css==CSSW3C))?0:1;rR=0;objT=kW3C?obj[tT].getElementsByTagName("tr")[rR]:obj[tT].all.tags("tr")[rR];if(objT)dragObject=objT;}else{tT=((typeof CSSW3C!=cUdf&&css==CSSW3C)||background)?0:(obj.length>2?2:1);rR=((typeof CSSW3C!=cUdf&&css==CSSW3C)&&cap||background)?1:0;if(hidecontent)contentLocation=tT+":"+rR ;objI=kW3C?obj[tT].getElementsByTagName("img"):obj[tT].all.tags("img");if(objI){for(var i=0;i<objI.length;i++){if(objI[i].name!=dragimg)continue;objI[i].id=dragimg;if(hidecontent)contentLocation=null;if(capicon){tT=(typeof CSSW3C!=cUdf&&css==CSSW3C)?0:1;rR=cC=0;objT=kW3C?obj[tT].getElementsByTagName("tr")[rR].getElementsByTagName("td")[cC]:obj[tT].all.tags("tr")[rR].all.tags("td")[cC];objI=kW3C?objT.getElementsByTagName("img"):objT.all.tags("img");if(objI){objI[0].removeAttribute("name");objI[0].removeAttribute("id");objI[0].removeAttribute("alt");objI[0].removeAttribute("title");}}}}}}}}
function setCursor(on){if(cNs4)return;cTip.style.cursor=(on?'move':'auto');}
function chkCursorPosition(Obj,XPos,YPos){var pos,Top,Left,iObj;if(Obj){with(po){anchorx=anchory=0;if(dragcap){Left=pageLocation(Obj,'Left');Top=pageLocation(Obj,'Top');if(XPos<Left||XPos>(Left+Obj.offsetWidth)||YPos<Top||YPos>(Top+Obj.offsetHeight))return false;}else if(dragimg){anchoralign='LR';pos=getAnchorLocation(Obj);iObj=(cNs4)?Obj[0]:Obj;if(XPos<pos[0]||XPos>(pos[0]+iObj.width)||YPos<pos[1]||YPos>(pos[1]+iObj.height))return false;}}}
return true;}
function grabEl(e){e=(e)?e:event;var X,Y;var cKy=(cNs4?e.modifiers&Event.ALT_MASK:((!cOp||cOp8)?e.altKey:e.ctrlKey));if(po.dragObject||(po.altcut?!cKy:cKy)){po.beingDragged=1;if(!cNs4&&po.hidecontent)showHideContent(e,'hide');
X=(e.pageX||eval('e.clientX+cFrame.'+docRoot+'.scrollLeft'));Y=(e.pageY||eval('e.clientY+cFrame.'+docRoot+'.scrollTop'));if(chkCursorPosition(po.dragcap?po.dragObject:po.imgObject,X,Y)){capExtent.onmousemove=moveEl;if(cNs4)cTip.captureEvents(Event.MOUSEUP);cTip.onmouseup=function(e){setCursor(0);if(cIe4)this.onselectstart=null;this.pop.beingDragged=0;if(this.pop.hidecontent&&this.pop.contentLocation)showHideContent(e);capExtent.onmousemove=cMseMv;}
setCursor(1);if(cIe4)cTip.onselectstart=function(){return false;}
if(cNs4){cX=X
cY=Y
}else{
cX=X-(cNs4?cTip.left:parseInt(cTip.style.left));cY=Y-(cNs4?cTip.top:parseInt(cTip.style.top));}
return(cNs4?routeEvent(e):false);}
}else setCursor(0);}
function moveEl(e){e=(e)?e:event;var dX,dY,X,Y;
X=(e.pageX||eval('e.clientX+cFrame.'+docRoot+'.scrollLeft'));Y=(e.pageY||eval('e.clientY+cFrame.'+docRoot+'.scrollTop'));if(chkCursorPosition(po.dragcap?po.dragObject:po.imgObject,X,Y)){if(cNs4){dX=X-cX;cX=X;dY=Y-cY;cY=Y;cTip.moveBy(dX,dY);}else
repositionTo(cTip,X-cX,Y-cY);}}
function showHideContent(e,whichType){e=(e)?e:event;var obj,cL,tT,rR,kW3C=(document.getElementsByTagName)?1:0;if(po.hidecontent&&po.contentLocation){cL=po.contentLocation.split(':');tT=parseInt(cL[0]);rR=parseInt(cL[1]);obj=kW3C?cTip.getElementsByTagName("table"):cTip.tags("table");obj=kW3C?obj[tT].getElementsByTagName("tr")[rR].getElementsByTagName("td")[0]:obj[tT].all.tags("tr")[rR].all.tags("td")[0];obj.style.visibility=(!whichType)?'visible':'hidden';}}
function endDrag(obj){if(!obj)obj=cTip;if(cNs4){obj.releaseEvents(Event.MOUSEDOWN|Event.MOUSEUP|Event.CLICK);obj.onmousedown=obj.onmouseup=obj.onclick=null;}else{obj.onmousedown=null;if(obj.pop.hidecontent&&obj.pop.contentLocation)obj.onmouseup=null;}}
registerRunTimeFunction(setDragVariables);registerCmdLineFunction(parseDragExtras);registerHook("disp",startDrag,FBEFORE);registerHook("hideObject",stopDrag,FAFTER);registerHook("ctCreatePopup",checkBodyImages,FAFTER);if(cInfo.meets(1.00))registerNoParameterCommands('draggable,dragcap,altcut,hidecontent');}

