2 function Card(ID, OverlapTolerance){
3 this.elm=document.getElementById(ID);
5 this.css=this.elm.style;
6 this.elm.style.left = 0 +'px';
7 this.elm.style.top = 0 +'px';
12 this.OverlapTolerance = OverlapTolerance;
15 function CardGetL(){return parseInt(this.css.left)}
16 Card.prototype.GetL=CardGetL;
18 function CardGetT(){return parseInt(this.css.top)}
19 Card.prototype.GetT=CardGetT;
21 function CardGetW(){return parseInt(this.elm.offsetWidth)}
22 Card.prototype.GetW=CardGetW;
24 function CardGetH(){return parseInt(this.elm.offsetHeight)}
25 Card.prototype.GetH=CardGetH;
27 function CardGetB(){return this.GetT()+this.GetH()}
28 Card.prototype.GetB=CardGetB;
30 function CardGetR(){return this.GetL()+this.GetW()}
31 Card.prototype.GetR=CardGetR;
33 function CardSetL(NewL){this.css.left = NewL+'px'}
34 Card.prototype.SetL=CardSetL;
36 function CardSetT(NewT){this.css.top = NewT+'px'}
37 Card.prototype.SetT=CardSetT;
39 function CardSetW(NewW){this.css.width = NewW+'px'}
40 Card.prototype.SetW=CardSetW;
42 function CardSetH(NewH){this.css.height = NewH+'px'}
43 Card.prototype.SetH=CardSetH;
45 function CardInside(X,Y){
47 if(X>=this.GetL()){if(X<=this.GetR()){if(Y>=this.GetT()){if(Y<=this.GetB()){Result=true;}}}}
50 Card.prototype.Inside=CardInside;
52 function CardSwapColours(){
53 var c=this.css.backgroundColor;
54 this.css.backgroundColor=this.css.color;
57 Card.prototype.SwapColours=CardSwapColours;
59 function CardHighlight(){
60 this.css.backgroundColor='[strTextColor]';
61 this.css.color='[strExBGColor]';
63 Card.prototype.Highlight=CardHighlight;
65 function CardUnhighlight(){
66 this.css.backgroundColor='[strExBGColor]';
67 this.css.color='[strTextColor]';
69 Card.prototype.Unhighlight=CardUnhighlight;
71 function CardOverlap(OtherCard){
72 var smR=(this.GetR()<(OtherCard.GetR()+this.OverlapTolerance))? this.GetR(): (OtherCard.GetR()+this.OverlapTolerance);
73 var lgL=(this.GetL()>OtherCard.GetL())? this.GetL(): OtherCard.GetL();
75 if (HDim<1){return 0;}
76 var smB=(this.GetB()<OtherCard.GetB())? this.GetB(): OtherCard.GetB();
77 var lgT=(this.GetT()>OtherCard.GetT())? this.GetT(): OtherCard.GetT();
79 if (VDim<1){return 0;}
82 Card.prototype.Overlap=CardOverlap;
84 function CardDockToR(OtherCard){
85 this.SetL(OtherCard.GetR() + 5);
86 this.SetT(OtherCard.GetT());
89 Card.prototype.DockToR=CardDockToR;
91 function CardSetHome(){
92 this.HomeL=this.GetL();
93 this.HomeT=this.GetT();
95 Card.prototype.SetHome=CardSetHome;
97 function CardGoHome(){
98 this.SetL(this.HomeL);
99 this.SetT(this.HomeT);
102 Card.prototype.GoHome=CardGoHome;
106 if (CurrDrag == -1) {return};
107 if (C.ie){var Ev = window.event}else{var Ev = e}
108 var difX = Ev.clientX-window.lastX;
109 var difY = Ev.clientY-window.lastY;
110 var newX = DC[CurrDrag].GetL()+difX;
111 var newY = DC[CurrDrag].GetT()+difY;
112 DC[CurrDrag].SetL(newX);
113 DC[CurrDrag].SetT(newY);
114 window.lastX = Ev.clientX;
115 window.lastY = Ev.clientY;
119 function beginDrag(e, DragNum) {
122 var Ev = window.event;
123 document.onmousemove=doDrag;
124 document.onmouseup=endDrag;
128 window.onmousemove=doDrag;
129 window.onmouseup=endDrag;
131 DC[CurrDrag].Highlight();
133 DC[CurrDrag].css.zIndex = topZ;
134 window.lastX=Ev.clientX;
135 window.lastY=Ev.clientY;
139 function endDrag(e) {
140 if (CurrDrag == -1) {return};
141 DC[CurrDrag].Unhighlight();
142 if (C.ie){document.onmousemove=null}else{window.onmousemove=null;}
145 //Need a bugfix for Opera focus problem here
146 if (C.opera){FocusAButton();}