root/trunk/website/soundings/admin/javaScripts.js

Revision 5, 6.5 kB (checked in by DanWilson, 17 years ago)

Initial Commit Of ModelGlue? Website (upgrade to blogcfc 511)

Line 
1//Contents for menu 1
2var menu1=new Array()
3menu1[0]='<a href="surveys.cfm">Surveys</a>'
4menu1[1]='<a href="questions.cfm">Questions</a>'
5menu1[2]='<a href="questiontypes.cfm">Question Types</a>'
6
7//Contents for menu 2
8var menu2=new Array()
9menu2[0]='<a href="password.cfm">Set Password</a>'
10menu2[1]='<a href="users.cfm">Users</a>'
11
12
13//Contents for menu 3
14var menu3=new Array()
15menu3[0]='<a href="stats.cfm">Reporting</a>'
16
17
18//Contents for menu 4
19var menu4=new Array()
20menu4[0]='<a href="index.cfm">Admin Home</a>'
21menu4[1]='<a href="../">Soundings Home</a>'
22menu4[2]='<a href="index.cfm?logout=1">Logout</a>'
23
24       
25var menuwidth='185px' //default menu width
26var menubgcolor='#407ED8'  //menu bgcolor
27var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
28var hidemenu_onclick="yes" //hide menu when user clicks within menu?
29
30/////No further editting needed
31
32var ie4=document.all
33var ns6=document.getElementById&&!document.all
34
35if (ie4||ns6)
36document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
37
38function getposOffset(what, offsettype){
39var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
40var parentEl=what.offsetParent;
41while (parentEl!=null){
42totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
43parentEl=parentEl.offsetParent;
44}
45return totaloffset;
46}
47
48
49function showhide(obj, e, visible, hidden, menuwidth){
50if (ie4||ns6)
51dropmenuobj.style.left=dropmenuobj.style.top=-500
52if (menuwidth!=""){
53dropmenuobj.widthobj=dropmenuobj.style
54dropmenuobj.widthobj.width=menuwidth
55}
56if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
57obj.visibility=visible
58else if (e.type=="click")
59obj.visibility=hidden
60}
61
62function iecompattest(){
63return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
64}
65
66function clearbrowseredge(obj, whichedge){
67var edgeoffset=0
68if (whichedge=="rightedge"){
69var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
70dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
71if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
72edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
73}
74else{
75var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
76var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
77dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
78if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
79edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
80if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
81edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
82}
83}
84return edgeoffset
85}
86
87function populatemenu(what){
88if (ie4||ns6)
89dropmenuobj.innerHTML=what.join("")
90}
91
92
93function dropdownmenu(obj, e, menucontents, menuwidth){
94if (window.event) event.cancelBubble=true
95else if (e.stopPropagation) e.stopPropagation()
96clearhidemenu()
97dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
98populatemenu(menucontents)
99
100if (ie4||ns6){
101showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
102dropmenuobj.x=getposOffset(obj, "left")
103dropmenuobj.y=getposOffset(obj, "top")
104dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
105dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
106}
107
108return clickreturnvalue()
109}
110
111function clickreturnvalue(){
112if (ie4||ns6) return false
113else return true
114}
115
116function contains_ns6(a, b) {
117while (b.parentNode)
118if ((b = b.parentNode) == a)
119return true;
120return false;
121}
122
123function dynamichide(e){
124if (ie4&&!dropmenuobj.contains(e.toElement))
125delayhidemenu()
126else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
127delayhidemenu()
128}
129
130function hidemenu(e){
131if (typeof dropmenuobj!="undefined"){
132if (ie4||ns6)
133dropmenuobj.style.visibility="hidden"
134}
135}
136
137function delayhidemenu(){
138if (ie4||ns6)
139delayhide=setTimeout("hidemenu()",disappeardelay)
140}
141
142function clearhidemenu(){
143if (typeof delayhide!="undefined")
144clearTimeout(delayhide)
145}
146
147if (hidemenu_onclick=="yes")
148document.onclick=hidemenu
149
150function MM_preloadImages() { //v3.0
151  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
152    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
153    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
154}
155
156function MM_swapImgRestore() { //v3.0
157  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
158}
159
160function MM_findObj(n, d) { //v4.01
161  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
162    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
163  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
164  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
165  if(!x && d.getElementById) x=d.getElementById(n); return x;
166}
167
168function MM_swapImage() { //v3.0
169  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
170   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
171}
172
173
174function MM_swapImgRestore() { //v3.0
175  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
176}
177function MM_preloadImages() { //v3.0
178  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
179    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
180    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
181}
182
183function MM_findObj(n, d) { //v4.01
184  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
185    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
186  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
187  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
188  if(!x && d.getElementById) x=d.getElementById(n); return x;
189}
190
191function MM_swapImage() { //v3.0
192  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
193   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
194}
Note: See TracBrowser for help on using the browser.