1 |
4948
|
daigle
|
/*
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Purpose: Default style sheet for KNP project web pages
|
4 |
|
|
* Using this stylesheet rather than placing styles directly in
|
5 |
|
|
* the KNP web documents allows us to globally change the
|
6 |
|
|
* formatting styles of the entire site in one easy place.
|
7 |
|
|
* Copyright: 2000 Regents of the University of California and the
|
8 |
|
|
* National Center for Ecological Analysis and Synthesis
|
9 |
|
|
* Authors: Matt Jones
|
10 |
|
|
*
|
11 |
|
|
* '$Author: daigle $'
|
12 |
|
|
* '$Date: 2008-07-06 21:25:34 -0700 (Sun, 06 Jul 2008) $'
|
13 |
|
|
* '$Revision: 4080 $'
|
14 |
|
|
*
|
15 |
|
|
* This program is free software; you can redistribute it and/or modify
|
16 |
|
|
* it under the terms of the GNU General Public License as published by
|
17 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
18 |
|
|
* (at your option) any later version.
|
19 |
|
|
*
|
20 |
|
|
* This program is distributed in the hope that it will be useful,
|
21 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
|
|
* GNU General Public License for more details.
|
24 |
|
|
*
|
25 |
|
|
* You should have received a copy of the GNU General Public License
|
26 |
|
|
* along with this program; if not, write to the Free Software
|
27 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
|
|
var dragColumn = null;
|
31 |
|
|
|
32 |
|
|
function getStyleClass (className) {
|
33 |
|
|
for (var s = 0; s < document.styleSheets.length; s++) {
|
34 |
|
|
if(document.styleSheets[s].rules) {
|
35 |
|
|
for (var r = 0; r < document.styleSheets[s].rules.length; r++) {
|
36 |
|
|
if (document.styleSheets[s].rules[r].selectorText == '.' + className) {
|
37 |
|
|
return document.styleSheets[s].rules[r];
|
38 |
|
|
}
|
39 |
|
|
}
|
40 |
|
|
}
|
41 |
|
|
else if(document.styleSheets[s].cssRules){
|
42 |
|
|
for (var r = 0; r < document.styleSheets[s].cssRules.length; r++) {
|
43 |
|
|
if (document.styleSheets[s].cssRules[r].selectorText == '.' + className)
|
44 |
|
|
return document.styleSheets[s].cssRules[r]; }
|
45 |
|
|
}
|
46 |
|
|
}
|
47 |
|
|
return null;
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
function startColumnDrag(e) {
|
51 |
|
|
dragColumn = findAdjustColumn(e);
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
function findAdjustColumn(e) {
|
55 |
|
|
var objHeader2 = document.getElementById("col-header2");
|
56 |
|
|
var col2XPos = objHeader2.offsetLeft;
|
57 |
|
|
var objHeader3 = document.getElementById("col-header3");
|
58 |
|
|
var col3XPos = objHeader3.offsetLeft;
|
59 |
|
|
|
60 |
|
|
var mouseXPos = getMouseX(e);
|
61 |
|
|
|
62 |
|
|
var col2XDiff = col2XPos - mouseXPos;
|
63 |
|
|
var col3XDiff = col3XPos - mouseXPos;
|
64 |
|
|
|
65 |
|
|
if (col2XDiff > -3 && col2XDiff < 3) {
|
66 |
|
|
return 1;
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
if (col3XDiff > -3 && col3XDiff < 3) {
|
70 |
|
|
return 2;
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
return null;
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
function dragCol(e) {
|
77 |
|
|
if (dragColumn != null) {
|
78 |
|
|
var colLObj = document.getElementById("col-header" + dragColumn);
|
79 |
|
|
var colRObj = document.getElementById("col-header" + (dragColumn + 1));
|
80 |
|
|
var mouseXPos = getMouseX(e);
|
81 |
|
|
var colRXPos = colRObj.offsetLeft;
|
82 |
|
|
var mouseXOffset = mouseXPos - colRXPos;
|
83 |
|
|
var colStyleClass = getStyleClass("col" + dragColumn);
|
84 |
|
|
var colTopStyleClass = getStyleClass("col" + dragColumn + "-top");
|
85 |
|
|
colStyleClass.style.width = colLObj.offsetWidth + mouseXOffset;
|
86 |
|
|
colTopStyleClass.style.width = colLObj.offsetWidth + mouseXOffset -2;
|
87 |
|
|
}
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
function changeCursor(e) {
|
91 |
|
|
tableClass = getStyleClass("col");
|
92 |
|
|
if (findAdjustColumn(e) != null) {
|
93 |
|
|
tableClass.style.cursor = "move";
|
94 |
|
|
} else {
|
95 |
|
|
tableClass.style.cursor = "auto";
|
96 |
|
|
}
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
function handleMouseOut() {
|
100 |
|
|
tableClass = getStyleClass("col");
|
101 |
|
|
tableClass.style.cursor = "auto";
|
102 |
|
|
reset();
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
|
function reset() {
|
106 |
|
|
dragColumn = null;
|
107 |
|
|
tableOffsetWidth = null;
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
function getMouseX(e) {
|
111 |
|
|
if (e.pageX) {
|
112 |
|
|
var posx = e.pageX
|
113 |
|
|
} else {
|
114 |
|
|
posx = e.clientX + document.body.scrollLeft
|
115 |
|
|
+ document.documentElement.scrollLeft;
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
// catch possible negative values in NS4
|
119 |
|
|
if (posx < 0) {
|
120 |
|
|
posx = 0
|
121 |
|
|
}
|
122 |
|
|
|
123 |
|
|
return posx
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
function swapFolder(openImageLocation, closedImageLocation, img) {
|
127 |
|
|
var openImg = new Image();
|
128 |
|
|
openImg.src = openImageLocation;
|
129 |
|
|
var closedImg = new Image();
|
130 |
|
|
closedImg.src = closedImageLocation;
|
131 |
|
|
|
132 |
|
|
objImg = document.getElementById(img);
|
133 |
|
|
if(objImg.src.indexOf(closedImageLocation)>-1)
|
134 |
|
|
objImg.src = openImg.src;
|
135 |
|
|
else
|
136 |
|
|
objImg.src = closedImg.src;
|
137 |
|
|
}
|