[1151] | 1 | /***************************************************** |
---|
| 2 | * ypSlideOutMenu |
---|
| 3 | * 3/04/2001 |
---|
| 4 | * |
---|
| 5 | * a nice little script to create exclusive, slide-out |
---|
| 6 | * menus for ns4, ns6, mozilla, opera, ie4, ie5 on |
---|
| 7 | * mac and win32. I've got no linux or unix to test on but |
---|
| 8 | * it should(?) work... |
---|
| 9 | * |
---|
| 10 | * --youngpup-- |
---|
| 11 | *****************************************************/ |
---|
| 12 | |
---|
| 13 | //var isIE = false; |
---|
| 14 | //var isOther = false; |
---|
| 15 | //var isNS4 = false; |
---|
| 16 | //var isNS6 = false; |
---|
| 17 | // constructor |
---|
| 18 | function ypSlideOutMenu(id, dir, left, top, width, height,pos) |
---|
| 19 | { |
---|
| 20 | |
---|
| 21 | this.ie = document.all ? 1 : 0 |
---|
| 22 | this.ns4 = document.layers ? 1 : 0 |
---|
| 23 | this.dom = document.getElementById ? 1 : 0 |
---|
| 24 | |
---|
| 25 | if (this.ie || this.ns4 || this.dom) { |
---|
| 26 | this.id = id |
---|
| 27 | this.dir = dir |
---|
| 28 | this.orientation = dir == "left" || dir == "right" ? "h" : "v" |
---|
| 29 | this.dirType = dir == "right" || dir == "down" ? "-" : "+" |
---|
| 30 | this.dim = this.orientation == "h" ? width : height |
---|
| 31 | //this.hideTimer = false |
---|
| 32 | //this.aniTimer = false |
---|
| 33 | this.open = false |
---|
| 34 | this.over = false |
---|
| 35 | //this.startTime = 0 |
---|
| 36 | |
---|
| 37 | // global reference to this object |
---|
| 38 | //this.gRef = "ypSlideOutMenu_"+id |
---|
| 39 | //eval(this.gRef+"=this") |
---|
| 40 | |
---|
| 41 | // add this menu object to an internal list of all menus |
---|
| 42 | //ypSlideOutMenu.Registry[id] = this |
---|
| 43 | |
---|
| 44 | var d = document |
---|
| 45 | |
---|
| 46 | var strCSS = '<style type="text/css">'; |
---|
| 47 | strCSS += '#' + this.id + 'Container { visibility:hidden; ' |
---|
| 48 | if(pos) |
---|
| 49 | { |
---|
| 50 | strCSS += pos+':' + left + 'px; ' |
---|
| 51 | } |
---|
| 52 | else |
---|
| 53 | { |
---|
| 54 | strCSS += 'left:' + left + 'px; ' |
---|
| 55 | } |
---|
| 56 | strCSS += 'top:' + top + 'px; ' |
---|
| 57 | strCSS += 'overflow:visible; z-index:10000; }' |
---|
| 58 | strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; ' |
---|
| 59 | strCSS += 'width:' + width + 'px; ' |
---|
| 60 | // strCSS += 'height:' + height + 'px; ' |
---|
| 61 | // strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); ' |
---|
| 62 | strCSS += '}' |
---|
| 63 | strCSS += '</style>'; |
---|
| 64 | |
---|
| 65 | d.write(strCSS); |
---|
| 66 | // alert(strCSS); |
---|
| 67 | // this.load() |
---|
| 68 | |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | ypSlideOutMenu.aLs = function(layerID) |
---|
| 73 | { |
---|
| 74 | |
---|
| 75 | this.isIE = false; |
---|
| 76 | this.isOther = false; |
---|
| 77 | this.isNS4 = false; |
---|
| 78 | this.isNS6 = false; |
---|
| 79 | if(document.getElementById) |
---|
| 80 | { |
---|
| 81 | if(!document.all) |
---|
| 82 | { |
---|
| 83 | this.isNS6=true; |
---|
| 84 | } |
---|
| 85 | if(document.all) |
---|
| 86 | { |
---|
| 87 | this.isIE=true; |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | else |
---|
| 91 | { |
---|
| 92 | if(document.layers) |
---|
| 93 | { |
---|
| 94 | this.isNS4=true; |
---|
| 95 | } |
---|
| 96 | else |
---|
| 97 | { |
---|
| 98 | this.isOther=true; |
---|
| 99 | } |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | var returnLayer; |
---|
| 103 | if(this.isIE) |
---|
| 104 | { |
---|
| 105 | returnLayer = eval("document.all." + layerID + ".style"); |
---|
| 106 | } |
---|
| 107 | if(this.isNS6) |
---|
| 108 | { |
---|
| 109 | returnLayer = eval("document.getElementById('" + layerID + "').style"); |
---|
| 110 | } |
---|
| 111 | if(this.isNS4) |
---|
| 112 | { |
---|
| 113 | returnLayer = eval("document." + layerID); |
---|
| 114 | } |
---|
| 115 | if(this.isOther) |
---|
| 116 | { |
---|
| 117 | returnLayer = "null"; |
---|
| 118 | alert("Error:\nDue to your browser you will probably not\nbe able to view all of the following page\nas it was designed to be viewed. We regret\nthis error sincerely."); |
---|
| 119 | } |
---|
| 120 | return returnLayer; |
---|
| 121 | } |
---|
| 122 | // HideShow 1.0 Jim Cummins - http://www.conxiondesigns.com |
---|
| 123 | |
---|
| 124 | ypSlideOutMenu.ShowL = function(ID) |
---|
| 125 | { |
---|
| 126 | ypSlideOutMenu.aLs(ID).visibility = "visible"; |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | ypSlideOutMenu.HideL =function(ID) |
---|
| 130 | { |
---|
| 131 | ypSlideOutMenu.aLs(ID).visibility = "hidden"; |
---|
| 132 | } |
---|
| 133 | |
---|
| 134 | ypSlideOutMenu.HideShow = function(ID) |
---|
| 135 | { |
---|
| 136 | |
---|
| 137 | if((ypSlideOutMenu.aLs(ID).visibility == "visible") || (ypSlideOutMenu.aLs(ID).visibility == "")) |
---|
| 138 | { |
---|
| 139 | ypSlideOutMenu.aLs(ID).visibility = "hidden"; |
---|
| 140 | } |
---|
| 141 | else if(ypSlideOutMenu.aLs(ID).visibility == "hidden") |
---|
| 142 | { |
---|
| 143 | ypSlideOutMenu.aLs(ID).visibility = "visible"; |
---|
| 144 | } |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | |
---|
| 148 | ypSlideOutMenu.showMenu = function(id) |
---|
| 149 | { |
---|
| 150 | //temporarly hide all selectboxes to fix IE bug with z-index |
---|
| 151 | if(document.all) |
---|
| 152 | { |
---|
| 153 | for (var i=0; i<document.all.length; i++) { |
---|
| 154 | o = document.all(i) |
---|
| 155 | if (o.type == 'select-one' || o.type == 'select-multiple') { |
---|
| 156 | // todo: add check for select in div? |
---|
| 157 | if (o.style) o.style.display = 'none'; |
---|
| 158 | } |
---|
| 159 | } |
---|
| 160 | } |
---|
| 161 | ypSlideOutMenu.ShowL(id+'Container'); |
---|
| 162 | |
---|
| 163 | } |
---|
| 164 | |
---|
| 165 | ypSlideOutMenu.hide = function(id) |
---|
| 166 | { |
---|
| 167 | ypSlideOutMenu.HideL(id+'Container'); |
---|
| 168 | //show all selectboxes again to fix IE bug with z-index |
---|
| 169 | if(document.all) |
---|
| 170 | { |
---|
| 171 | for (var i=0; i<document.all.length; i++) { |
---|
| 172 | o = document.all(i) |
---|
| 173 | if (o.type == 'select-one' || o.type == 'select-multiple') { |
---|
| 174 | // todo: add check for select in div? |
---|
| 175 | if (o.style) o.style.display = 'inline'; |
---|
| 176 | } |
---|
| 177 | } |
---|
| 178 | } |
---|
| 179 | |
---|
| 180 | } |
---|
| 181 | |
---|
| 182 | |
---|
| 183 | |
---|