Quick Search:

View

Revision:

Diff

Diff from 1165 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/branches/frank/osc-tickets/admin/includes/general.js

Annotated File View

hpdl
1
1 function rowOverEffect(object) {
2   object.className = 'mouseOver';
3 }
4
5 function rowOutEffect(object) {
6   object.className = '';
7 }
8
9 function updateDatePullDownMenu(objForm, fieldName) {
10   var pdmDays = fieldName + "_days";
11   var pdmMonths = fieldName + "_months";
12   var pdmYears = fieldName + "_years";
13
14   time = new Date(objForm[pdmYears].options[objForm[pdmYears].selectedIndex].text, objForm[pdmMonths].options[objForm[pdmMonths].selectedIndex].value, 1);
15
16   time = new Date(time - 86400000);
17
18   var selectedDay = objForm[pdmDays].options[objForm[pdmDays].selectedIndex].text;
19   var daysInMonth = time.getDate();
20
21   for (var i=0; i<objForm[pdmDays].length; i++) {
22     objForm[pdmDays].options[0] = null;
23   }
24
25   for (var i=0; i<daysInMonth; i++) {
26     objForm[pdmDays].options[i] = new Option(i+1);
27   }
28
29   if (selectedDay <= daysInMonth) {
30     objForm[pdmDays].options[selectedDay-1].selected = true;
31   } else {
32     objForm[pdmDays].options[daysInMonth-1].selected = true;
33   }
34 }
35
36 function toggleDivBlocks(group, exempt) {
37   if (!document.getElementsByTagName) return null;
38
39   if (!exempt) exempt = "";
40
41   var divs = document.getElementsByTagName("div");
42
43   for(var i=0; i < divs.length; i++) {
44     var div = divs[i];
45     var id = div.id;
46
47     if ((id != exempt) && (id.indexOf(group) == 0)) {
48       hideBlock(id);
49     }
50   }
51
52   showBlock(exempt);
53 }
54
55 function toggleInfoBox(exempt) {
56   if (!exempt || !document.getElementsByTagName) return null;
57
58   var infoBox = "infoBox_" + exempt;
59
60   var divs = document.getElementsByTagName("div");
61
62   for(var i=0; i < divs.length; i++) {
63     var div = divs[i];
64     var id = div.id;
65
66     if (id.indexOf("infoBox_") == 0) {
67       var infoBoxForm = id.substring(8);
68
69       if (document.forms[infoBoxForm]) {
70         document.forms[infoBoxForm].reset();
71       }
72
73       if (id != infoBox) {
74         hideBlock(id);
75       }
76     }
77   }
78
79   showBlock(infoBox);
80 }
81
82 function showBlock(id) {
83   if (document.getElementById) {
84     itm = document.getElementById(id);
85   } else if (document.all){
86     itm = document.all[id];
87   } else if (document.layers){
88     itm = document.layers[id];
89   }
90
91   if (itm) {
92     itm.style.display = "block";
93   }
94 }
95
96 function hideBlock(id) {
97   if (document.getElementById) {
98     itm = document.getElementById(id);
99   } else if (document.all){
100     itm = document.all[id];
101   } else if (document.layers){
102     itm = document.layers[id];
103   }
104
105   if (itm) {
106     itm.style.display = "none";
107   }
108 }
109
110 function toggleClass(removeClass, addClass, cssClass, tagName) {
111   if (!document.getElementsByTagName) return null;
112
113   if (!tagName) tagName = "div";
114
115   var tags = document.getElementsByTagName(tagName);
116
117   for(var i=0; i < tags.length; i++) {
118     var tag = tags[i];
119     var id = tag.id;
120
121     if ((id != addClass) && (id.indexOf(removeClass) == 0)) {
122       tag.className = "";
123     }
124   }
125
126   document.getElementById(addClass).className = cssClass;
127 }
128
hpdl
410
129 function selectAllFromPullDownMenu(field) {
130   var field = document.getElementById(field);
131
132   for (i=0; i < field.length; i++) {
133     field.options[i].selected = true;
134   }
135 }
136
137 function resetPullDownMenuSelection(field) {
138   var field = document.getElementById(field);
139
140   for (i=0; i < field.length; i++) {
141     field.options[i].selected = false;
142   }
143 }
144
hpdl
608
145 // Returns array with x,y page scroll values
146 // Core code from - quirksmode.org
147 function getPageScroll() {
148   var yScroll;
149
150   if (self.pageYOffset) {
151     yScroll = self.pageYOffset;
152   } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
153     yScroll = document.documentElement.scrollTop;
154   } else if (document.body) { // all other Explorers
155     yScroll = document.body.scrollTop;
156   }
157
158   arrayPageScroll = new Array('', yScroll);
159
160   return arrayPageScroll;
161 }
162
163 // Returns array with page width, height and window width, height
164 // Core code from - quirksmode.org
165 // Edit for Firefox by pHaez
166 function getPageSize() {
167   var xScroll, yScroll;
168
169   if (window.innerHeight && window.scrollMaxY) {
170     xScroll = document.body.scrollWidth;
171     yScroll = window.innerHeight + window.scrollMaxY;
172   } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
173     xScroll = document.body.scrollWidth;
174     yScroll = document.body.scrollHeight;
175   } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
176     xScroll = document.body.offsetWidth;
177     yScroll = document.body.offsetHeight;
178   }
179
180   var windowWidth, windowHeight;
181
182   if (self.innerHeight) { // all except Explorer
183     windowWidth = self.innerWidth;
184     windowHeight = self.innerHeight;
185   } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
186     windowWidth = document.documentElement.clientWidth;
187     windowHeight = document.documentElement.clientHeight;
188   } else if (document.body) { // other Explorers
189     windowWidth = document.body.clientWidth;
190     windowHeight = document.body.clientHeight;
191   }
192
193 // for small pages with total height less then height of the viewport
194   if (yScroll < windowHeight) {
195     pageHeight = windowHeight;
196   } else {
197     pageHeight = yScroll;
198   }
199
200 // for small pages with total width less then width of the viewport
201   if (xScroll < windowWidth) {
202     pageWidth = windowWidth;
203   } else {
204     pageWidth = xScroll;
205   }
206
207   arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
208
209   return arrayPageSize;
210 }