1var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc) 2var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only 3 4if (document.getElementById){ //DynamicDrive.com change 5document.write('<style type="text/css">\n') 6document.write('.submenu3{display: none;}\n') 7document.write('</style>\n') 8} 9 10function SwitchMenu(obj){ 11 if(document.getElementById){ 12 var el = document.getElementById(obj); 13 var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change 14 if(el.style.display != "block"){ //DynamicDrive.com change 15 for (var i=0; i<ar.length; i++){ 16 if (ar[i].className=="submenu3") //DynamicDrive.com change 17 ar[i].style.display = "none"; 18 } 19 el.style.display = "block"; 20 }else{ 21 el.style.display = "none"; 22 } 23 } 24} 25 26function get_cookie(Name) { 27var search = Name + "=" 28var returnvalue = ""; 29if (document.cookie.length > 0) { 30offset = document.cookie.indexOf(search) 31if (offset != -1) { 32offset += search.length 33end = document.cookie.indexOf(";", offset); 34if (end == -1) end = document.cookie.length; 35returnvalue=unescape(document.cookie.substring(offset, end)) 36} 37} 38return returnvalue; 39} 40 41function onloadfunction(){ 42if (persistmenu=="yes"){ 43var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname 44var cookievalue=get_cookie(cookiename) 45if (cookievalue!="") 46document.getElementById(cookievalue).style.display="block" 47} 48} 49 50function savemenustate(){ 51var inc=1, blockid="" 52while (document.getElementById("sub"+inc)){ 53if (document.getElementById("sub"+inc).style.display=="block"){ 54blockid="sub"+inc 55break 56} 57inc++ 58} 59var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname 60var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid 61document.cookie=cookiename+"="+cookievalue 62} 63 64if (window.addEventListener) 65window.addEventListener("load", onloadfunction, false) 66else if (window.attachEvent) 67window.attachEvent("onload", onloadfunction) 68else if (document.getElementById) 69window.onload=onloadfunction 70 71if (persistmenu=="yes" && document.getElementById) 72window.onunload=savemenustate 73 74 75//** Animated Collapsible DIV v2.0- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com. 76//** May 24th, 08'- Script rewritten and updated to 2.0. 77//** June 4th, 08'- Version 2.01: Bug fix to work with jquery 1.2.6 (which changed the way attr() behaves). 78//** March 5th, 09'- Version 2.2, which adds the following: 79 //1) ontoggle($, divobj, state) event that fires each time a DIV is expanded/collapsed, including when the page 1st loads 80 //2) Ability to expand a DIV via a URL parameter string, ie: index.htm?expanddiv=jason or index.htm?expanddiv=jason,kelly 81 82//** March 9th, 09'- Version 2.2.1: Optimized ontoggle event handler slightly. 83//** July 3rd, 09'- Version 2.4, which adds the following: 84 //1) You can now insert rel="expand[divid] | collapse[divid] | toggle[divid]" inside arbitrary links to act as DIV togglers 85 //2) For image toggler links, you can insert the attributes "data-openimage" and "data-closedimage" to update its image based on the DIV state 86 87var animatedcollapse={ 88divholders: {}, //structure: {div.id, div.attrs, div.$divref, div.$togglerimage} 89divgroups: {}, //structure: {groupname.count, groupname.lastactivedivid} 90lastactiveingroup: {}, //structure: {lastactivediv.id} 91preloadimages: [], 92 93show:function(divids){ //public method 94 if (typeof divids=="object"){ 95 for (var i=0; i<divids.length; i++) 96 this.showhide(divids[i], "show") 97 } 98 else 99 this.showhide(divids, "show") 100}, 101 102hide:function(divids){ //public method 103 if (typeof divids=="object"){ 104 for (var i=0; i<divids.length; i++) 105 this.showhide(divids[i], "hide") 106 } 107 else 108 this.showhide(divids, "hide") 109}, 110 111toggle:function(divid){ //public method 112 if (typeof divid=="object") 113 divid=divid[0] 114 this.showhide(divid, "toggle") 115}, 116 117addDiv:function(divid, attrstring){ //public function 118 this.divholders[divid]=({id: divid, $divref: null, attrs: attrstring}) 119 this.divholders[divid].getAttr=function(name){ //assign getAttr() function to each divholder object 120 var attr=new RegExp(name+"=([^,]+)", "i") //get name/value config pair (ie: width=400px,) 121 return (attr.test(this.attrs) && parseInt(RegExp.$1)!=0)? RegExp.$1 : null //return value portion (string), or 0 (false) if none found 122 } 123 this.currentid=divid //keep track of current div object being manipulated (in the event of chaining) 124 return this 125}, 126 127showhide:function(divid, action){ 128 var $divref=this.divholders[divid].$divref //reference collapsible DIV 129 if (this.divholders[divid] && $divref.length==1){ //if DIV exists 130 var targetgroup=this.divgroups[$divref.attr('groupname')] //find out which group DIV belongs to (if any) 131 if ($divref.attr('groupname') && targetgroup.count>1 && (action=="show" || action=="toggle" && $divref.css('display')=='none')){ //If current DIV belongs to a group 132 if (targetgroup.lastactivedivid && targetgroup.lastactivedivid!=divid) //if last active DIV is set 133 this.slideengine(targetgroup.lastactivedivid, 'hide') //hide last active DIV within group first 134 this.slideengine(divid, 'show') 135 targetgroup.lastactivedivid=divid //remember last active DIV 136 } 137 else{ 138 this.slideengine(divid, action) 139 } 140 } 141}, 142 143slideengine:function(divid, action){ 144 var $divref=this.divholders[divid].$divref 145 var $togglerimage=this.divholders[divid].$togglerimage 146 if (this.divholders[divid] && $divref.length==1){ //if this DIV exists 147 var animateSetting={height: action} 148 if ($divref.attr('fade')) 149 animateSetting.opacity=action 150 $divref.animate(animateSetting, $divref.attr('speed')? parseInt($divref.attr('speed')) : 500, function(){ 151 if ($togglerimage){ 152 $togglerimage.attr('src', ($divref.css('display')=="none")? $togglerimage.data('srcs').closed : $togglerimage.data('srcs').open
152) 153 } 154 if (animatedcollapse.ontoggle){ 155 try{ 156 animatedcollapse.ontoggle(jQuery, $divref.get(0), $divref.css('display')) 157 } 158 catch(e){ 159 alert("An error exists inside your \"ontoggle\" function:\n\n"+e+"\n\nAborting execution of function.") 160 } 161 } 162 }) 163 return false 164 } 165}, 166 167generatemap:function(){ 168 var map={} 169 for (var i=0; i<arguments.length; i++){ 170 if (arguments[i][1]!=null){ //do not generate name/value pair if value is null 171 map[arguments[i][0]]=arguments[i][1] 172 } 173 } 174 return map 175}, 176 177init:function(){ 178 var ac=this 179 jQuery(document).ready(function($){ 180 animatedcollapse.ontoggle=animatedcollapse.ontoggle || null 181 var urlparamopenids=animatedcollapse.urlparamselect() //Get div ids that should be expanded based on the url (['div1','div2',etc]) 182 var persistopenids=ac.getCookie('acopendivids') //Get list of div ids that should be expanded due to persistence ('div1,div2,etc') 183 var groupswithpersist=ac.getCookie('acgroupswithpersist') //Get list of group names that have 1 or more divs with "persist" attribute defined 184 if (persistopenids!=null) //if cookie isn't null (is null if first time page loads, and cookie hasnt been set yet) 185 persistopenids=(persistopenids=='nada')? [] : persistopenids.split(',') //if no divs are persisted, set to empty array, else, array of div ids 186 groupswithpersist=(groupswithpersist==null || groupswithpersist=='nada')? [] : groupswithpersist.split(',') //Get list of groups with divs that are persisted 187 jQuery.each(ac.divholders, function(){ //loop through each collapsible DIV object 188 this.$divref=$('#'+this.id) 189 if ((this.getAttr('persist') || jQuery.inArray(this.getAttr('group'), groupswithpersist)!=-1) && persistopenids!=null){ //if this div carries a user "persist" setting, or belong to a group with at least one div that does 190 var cssdisplay=(jQuery.inArray(this.id, persistopenids)!=-1)? 'block' : 'none' 191 } 192 else{ 193 var cssdisplay=this.getAttr('hide')? 'none' : null 194 } 195 if (urlparamopenids[0]=="all" || jQuery.inArray(this.id, urlparamopenids)!=-1){ //if url parameter string contains the single array element "all", or this div's ID 196 cssdisplay='block' //set div to "block", overriding any other setting 197 } 198 else if (urlparamopenids[0]=="none"){ 199 cssdisplay='none' //set div to "none", overriding any other setting 200 } 201 this.$divref.css(ac.generatemap(['height', this.getAttr('height')], ['display', cssdisplay])) 202 this.$divref.attr(ac.generatemap(['groupname', this.getAttr('group')], ['fade', this.getAttr('fade')], ['speed', this.getAttr('speed')])) 203 if (this.getAttr('group')){ //if this DIV has the "group" attr defined 204 var targetgroup=ac.divgroups[this.getAttr('group')] || (ac.divgroups[this.getAttr('group')]={}) //Get settings for this group, or if it no settings exist yet, create blank object to store them in 205 targetgroup.count=(targetgroup.count||0)+1 //count # of DIVs within this group 206 if (jQuery.inArray(this.id, urlparamopenids)!=-1){ //if url parameter string contains this div's ID 207 targetgroup.lastactivedivid=this.id //remember this DIV as the last "active" DIV (this DIV will be expanded). Overrides other settings 208 targetgroup.overridepersist=1 //Indicate to override persisted div that would have been expanded 209 } 210 if (!targetgroup.lastactivedivid && this.$divref.css('display')!='none' || cssdisplay=="block" && typeof targetgroup.overridepersist=="undefined") //if this DIV was open by default or should be open due to persistence 211 targetgroup.lastactivedivid=this.id //remember this DIV as the last "active" DIV (this DIV will be expanded) 212 this.$divref.css({display:'none'}) //hide any DIV that's part of said group for now 213 } 214 }) //end divholders.each 215 jQuery.each(ac.divgroups, function(){ //loop through each group 216 if (this.lastactivedivid && urlparamopenids[0]!="none") //show last "active" DIV within each group (one that should be expanded), unless url param="none" 217 ac.divholders[this.lastactivedivid].$divref.show() 218 }) 219 if (animatedcollapse.ontoggle){ 220 jQuery.each(ac.divholders, function(){ //loop through each collapsible DIV object and fire ontoggle event 221 animatedcollapse.ontoggle(jQuery, this.$divref.get(0), this.$divref.css('display')) 222 }) 223 } 224 //Parse page for links containing rel attribute 225 var $allcontrols=$('a[rel]').filter('[rel^="collapse["], [rel^="expand["], [rel^="toggle["]') //get all elements on page with rel="collapse[]", "expand[]" and "toggle[]" 226 $allcontrols.each(function(){ //loop though each control link 227 this._divids=this.getAttribute('rel').replace(/(^\w+)|(\s+)/g, "").replace(/[\[\]']/g, "") //cache value 'div1,div2,etc' within identifier[div1,div2,etc] 228 if (this.getElementsByTagName('img').length==1 && ac.divholders[this._divids]){ //if control is an image link that toggles a single DIV (must be one to one to update status image) 229 animatedcollapse.preloadimage(this.getAttribute('data-openimage'), this.getAttribute('data-closedimage')) //preload control images (if defined) 230 $togglerimage=$(this).find('img').eq(0).data('srcs', {open:this.getAttribute('data-openimage'), closed:this.getAttribute('data-closedimage')}) //remember open and closed images' paths 231 ac.divholders[this._divids].$togglerimage=$(this).find('img').eq(0) //save reference to toggler image (to be updated inside slideengine() 232 ac.divholders[this._divids].$togglerimage.attr('src', (ac.divholders[this._divids].$divref.css('display')=="none")? $togglerimage.data('srcs').closed : $togglerimage.data('srcs').open
232) 233 } 234 $(this).click(function(){ //assign click behavior to each control link 235 var relattr=this.getAttribute('rel') 236 var divids=(this._divids=="")? [] : this._divids.split(',') //convert 'div1,div2,etc' to array 237 if (divids.length>0){ 238 animatedcollapse[/expand/i.test(relattr)? 'show' : /collapse/i.test(relattr)? 'hide' : 'toggle'](divids) //call corresponding public function 239 return false 240 } 241 }) //end control.click 242 })// end control.each 243 244 $(window).bind('unload', function(){ 245 ac.uninit() 246 }) 247 }) //end doc.ready() 248}, 249 250uninit:function(){ 251 var opendivids='', groupswithpersist='' 252 jQuery.each(this.divholders, function(){ 253 if (this.$divref.css('display')!='none'){ 254 opendivids+=this.id+',' //store ids of DIVs that are expanded when page unloads: 'div1,div2,etc' 255 } 256 if (this.getAttr('group') && this.getAttr('persist')) 257 groupswithpersist+=this.getAttr('group')+',' //store groups with which at least one DIV has persistance enabled: 'group1,group2,etc' 258 }) 259 opendivids=(opendivids=='')? 'nada' : opendivids.replace(/,$/, '') 260 groupswithpersist=(groupswithpersist=='')? 'nada' : groupswithpersist.replace(/,$/, '') 261 this.setCookie('acopendivids', opendivids) 262 this.setCookie('acgroupswithpersist', groupswithpersist) 263}, 264 265getCookie:function(Name){ 266 var re=new RegExp(Name+"=[^;]*", "i"); //construct RE to search for target name/value pair 267 if (document.cookie.match(re)) //if cookie found 268 return document.cookie.match(re)[0].split("=")[1] //return its value 269 return null 270}, 271 272setCookie:function(name, value, days){ 273 if (typeof days!="undefined"){ //if set persistent cookie 274 var expireDate = new Date() 275 expireDate.setDate(expireDate.getDate()+days) 276 document.cookie = name+"="+value+"; path=/; expires="+expireDate.toGMTString() 277 } 278 else //else if this is a session only cookie 279 document.cookie = name+"="+value+"; path=/" 280}, 281 282urlparamselect:function(){ 283 window.location.search.match(/expanddiv=([\w\-_,]+)/i) //search for expanddiv=divid or divid1,divid2,etc 284 return (RegExp.$1!="")? RegExp.$1.split(",") : [] 285}, 286 287preloadimage:function(){ 288 var preloadimages=this.preloadimages 289 for (var i=0; i<arguments.length; i++){ 290 if (arguments[i] && arguments[i].length>0){ 291 preloadimages[preloadimages.length]=new Image() 292 preloadimages[preloadimages.length-1].src=arguments[i] 293 } 294 } 295} 296 297} 298 299 300 301 302 303var current_selected_input = null; 304 305function specify_selected_input(el) { 306 $(el).up().addClassName('selectata'); 307 if (current_selected_input !== null) { 308 $(current_selected_input).up().removeClassName('selectata'); 309 } 310 311 current_selected_input = el; 312} 313 314
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.