blob: 95099a3a02eb0fec24c27b91669aaa428f058b95 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001var resizePackagesNav;
2var classesNav;
3var devdocNav;
4var sidenav;
5var content;
6var HEADER_HEIGHT = 117;
Dirk Dougherty4405a232009-07-07 17:43:27 -07007var cookie_namespace = 'android_developer';
The Android Open Source Project88b60792009-03-03 19:28:42 -08008var NAV_PREF_TREE = "tree";
9var NAV_PREF_PANELS = "panels";
10var nav_pref;
11var toRoot;
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -070012var isMobile = false; // true if mobile, so we can adjust some layout
Scott Main3f7d1df2009-11-02 15:31:04 -080013var isIE6 = false; // true if IE6
The Android Open Source Project88b60792009-03-03 19:28:42 -080014
Scott Mainf8af8872009-12-02 20:59:40 -080015// TODO: use $(document).ready instead
The Android Open Source Project88b60792009-03-03 19:28:42 -080016function addLoadEvent(newfun) {
17 var current = window.onload;
18 if (typeof window.onload != 'function') {
19 window.onload = newfun;
20 } else {
21 window.onload = function() {
22 current();
23 newfun();
24 }
25 }
26}
27
Scott Maind8115ff2009-11-03 18:54:26 -080028var agent = navigator['userAgent'].toLowerCase();
Scott Main3f7d1df2009-11-02 15:31:04 -080029// If a mobile phone, set flag and do mobile setup
Scott Maind8115ff2009-11-03 18:54:26 -080030if ((agent.indexOf("mobile") != -1) || // android, iphone, ipod
31 (agent.indexOf("blackberry") != -1) ||
32 (agent.indexOf("webos") != -1) ||
33 (agent.indexOf("mini") != -1)) { // opera mini browsers
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -070034 isMobile = true;
35 addLoadEvent(mobileSetup);
Scott Main3f7d1df2009-11-02 15:31:04 -080036// If not a mobile browser, set the onresize event for IE6, and others
Scott Maind8115ff2009-11-03 18:54:26 -080037} else if (agent.indexOf("msie 6") != -1) {
Scott Main3f7d1df2009-11-02 15:31:04 -080038 isIE6 = true;
39 addLoadEvent(function() {
40 window.onresize = resizeAll;
41 });
42} else {
43 addLoadEvent(function() {
44 window.onresize = resizeHeight;
45 });
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -070046}
47
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -070048function mobileSetup() {
49 $("body").css({'overflow':'auto'});
50 $("html").css({'overflow':'auto'});
51 $("#body-content").css({'position':'relative', 'top':'0'});
52 $("#doc-content").css({'overflow':'visible', 'border-left':'3px solid #DDD'});
53 $("#side-nav").css({'padding':'0'});
54 $("#nav-tree").css({'overflow-y': 'auto'});
55}
56
Scott Main25fda192009-08-04 11:26:30 -070057/* loads the lists.js file to the page.
58Loading this in the head was slowing page load time */
59addLoadEvent( function() {
60 var lists = document.createElement("script");
61 lists.setAttribute("type","text/javascript");
62 lists.setAttribute("src", toRoot+"reference/lists.js");
Scott Main1da82382009-09-17 10:54:05 -070063 document.getElementsByTagName("head")[0].appendChild(lists);
Scott Main25fda192009-08-04 11:26:30 -070064} );
65
Scott Mainf8af8872009-12-02 20:59:40 -080066addLoadEvent( function() {
67 $("pre").addClass("prettyprint");
68 prettyPrint();
69} );
70
The Android Open Source Project88b60792009-03-03 19:28:42 -080071function setToRoot(root) {
72 toRoot = root;
73 // note: toRoot also used by carousel.js
74}
75
76function restoreWidth(navWidth) {
77 var windowWidth = $(window).width() + "px";
Scott Main3f7d1df2009-11-02 15:31:04 -080078 content.css({marginLeft:parseInt(navWidth) + 6 + "px"}); //account for 6px-wide handle-bar
79
80 if (isIE6) {
81 content.css({width:parseInt(windowWidth) - parseInt(navWidth) - 6 + "px"}); // necessary in order for scrollbars to be visible
82 }
83
The Android Open Source Project88b60792009-03-03 19:28:42 -080084 sidenav.css({width:navWidth});
85 resizePackagesNav.css({width:navWidth});
86 classesNav.css({width:navWidth});
87 $("#packages-nav").css({width:navWidth});
88}
89
90function restoreHeight(packageHeight) {
91 var windowHeight = ($(window).height() - HEADER_HEIGHT);
92 var swapperHeight = windowHeight - 13;
93 $("#swapper").css({height:swapperHeight + "px"});
94 sidenav.css({height:windowHeight + "px"});
95 content.css({height:windowHeight + "px"});
96 resizePackagesNav.css({maxHeight:swapperHeight + "px", height:packageHeight});
97 classesNav.css({height:swapperHeight - parseInt(packageHeight) + "px"});
98 $("#packages-nav").css({height:parseInt(packageHeight) - 6 + "px"}); //move 6px to give space for the resize handle
99 devdocNav.css({height:sidenav.css("height")});
100 $("#nav-tree").css({height:swapperHeight + "px"});
101}
102
Dirk Dougherty4405a232009-07-07 17:43:27 -0700103function readCookie(cookie) {
104 var myCookie = cookie_namespace+"_"+cookie+"=";
The Android Open Source Project88b60792009-03-03 19:28:42 -0800105 if (document.cookie) {
106 var index = document.cookie.indexOf(myCookie);
107 if (index != -1) {
108 var valStart = index + myCookie.length;
109 var valEnd = document.cookie.indexOf(";", valStart);
110 if (valEnd == -1) {
111 valEnd = document.cookie.length;
112 }
113 var val = document.cookie.substring(valStart, valEnd);
114 return val;
115 }
116 }
117 return 0;
118}
119
Dirk Dougherty4405a232009-07-07 17:43:27 -0700120function writeCookie(cookie, val, section, expiration) {
Scott Main9b5fdb92009-10-27 15:09:15 -0700121 if (val==undefined) return;
Dirk Dougherty4405a232009-07-07 17:43:27 -0700122 section = section == null ? "_" : "_"+section+"_";
123 if (expiration == null) {
124 var date = new Date();
125 date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
126 expiration = date.toGMTString();
The Android Open Source Project88b60792009-03-03 19:28:42 -0800127 }
Scott Main3f7d1df2009-11-02 15:31:04 -0800128 document.cookie = cookie_namespace + section + cookie + "=" + val + "; expires=" + expiration+"; path=/";
The Android Open Source Project88b60792009-03-03 19:28:42 -0800129}
130
131function init() {
The Android Open Source Project88b60792009-03-03 19:28:42 -0800132 $("#side-nav").css({position:"absolute",left:0});
133 content = $("#doc-content");
134 resizePackagesNav = $("#resize-packages-nav");
135 classesNav = $("#classes-nav");
136 sidenav = $("#side-nav");
137 devdocNav = $("#devdoc-nav");
138
139 if (location.href.indexOf("/reference/") != -1) {
140 var cookiePath = "reference_";
141 } else if (location.href.indexOf("/guide/") != -1) {
142 var cookiePath = "guide_";
Dirk Dougherty502c4982009-12-02 18:01:16 -0800143 } else if (location.href.indexOf("/resources/") != -1) {
144 var cookiePath = "resources_";
The Android Open Source Project88b60792009-03-03 19:28:42 -0800145 }
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -0700146
147 if (!isMobile) {
Scott Main3f7d1df2009-11-02 15:31:04 -0800148 $("#resize-packages-nav").resizable({handles: "s", resize: function(e, ui) { resizePackagesHeight(); } });
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -0700149 $(".side-nav-resizable").resizable({handles: "e", resize: function(e, ui) { resizeWidth(); } });
Dirk Dougherty4405a232009-07-07 17:43:27 -0700150 var cookieWidth = readCookie(cookiePath+'width');
151 var cookieHeight = readCookie(cookiePath+'height');
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -0700152 if (cookieWidth) {
153 restoreWidth(cookieWidth);
154 } else if ($(".side-nav-resizable").length) {
155 resizeWidth();
156 }
157 if (cookieHeight) {
158 restoreHeight(cookieHeight);
159 } else {
160 resizeHeight();
161 }
The Android Open Source Project88b60792009-03-03 19:28:42 -0800162 }
163
164 if (devdocNav.length) { // only dev guide and sdk
165 highlightNav(location.href);
166 }
167}
168
169function highlightNav(fullPageName) {
170 var lastSlashPos = fullPageName.lastIndexOf("/");
Dirk Dougherty502c4982009-12-02 18:01:16 -0800171 var firstSlashPos;
172 if (fullPageName.indexOf("/guide/") != -1) {
173 firstSlashPos = fullPageName.indexOf("/guide/");
174 } else if (fullPageName.indexOf("/sdk/") != -1) {
175 firstSlashPos = fullPageName.indexOf("/sdk/");
176 } else {
177 firstSlashPos = fullPageName.indexOf("/resources/");
178 }
The Android Open Source Project88b60792009-03-03 19:28:42 -0800179 if (lastSlashPos == (fullPageName.length - 1)) { // if the url ends in slash (add 'index.html')
180 fullPageName = fullPageName + "index.html";
181 }
182 var htmlPos = fullPageName.lastIndexOf(".html", fullPageName.length);
183 var pathPageName = fullPageName.slice(firstSlashPos, htmlPos + 5);
184 var link = $("#devdoc-nav a[href$='"+ pathPageName+"']");
Scott Main0d8872e2009-10-23 13:04:31 -0700185 if ((link.length == 0) && (fullPageName.indexOf("/guide/") != -1)) {
186// if there's no match, then let's backstep through the directory until we find an index.html page that matches our ancestor directories (only for dev guide)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800187 lastBackstep = pathPageName.lastIndexOf("/");
188 while (link.length == 0) {
189 backstepDirectory = pathPageName.lastIndexOf("/", lastBackstep);
190 link = $("#devdoc-nav a[href$='"+ pathPageName.slice(0, backstepDirectory + 1)+"index.html']");
191 lastBackstep = pathPageName.lastIndexOf("/", lastBackstep - 1);
192 if (lastBackstep == 0) break;
193 }
194 }
195 link.parent().addClass('selected');
196 if (link.parent().parent().is(':hidden')) {
197 toggle(link.parent().parent().parent(), false);
198 } else if (link.parent().parent().hasClass('toggle-list')) {
199 toggle(link.parent().parent(), false);
200 }
201}
202
Scott Main3f7d1df2009-11-02 15:31:04 -0800203/* Resize the height of the nav panels in the reference,
204 * and save the new size to a cookie */
205function resizePackagesHeight() {
The Android Open Source Project88b60792009-03-03 19:28:42 -0800206 var windowHeight = ($(window).height() - HEADER_HEIGHT);
Scott Main3f7d1df2009-11-02 15:31:04 -0800207 var swapperHeight = windowHeight - 13; // move 13px for swapper link at the bottom
The Android Open Source Project88b60792009-03-03 19:28:42 -0800208 resizePackagesNav.css({maxHeight:swapperHeight + "px"});
209 classesNav.css({height:swapperHeight - parseInt(resizePackagesNav.css("height")) + "px"});
Scott Main3f7d1df2009-11-02 15:31:04 -0800210
211 $("#swapper").css({height:swapperHeight + "px"});
The Android Open Source Project88b60792009-03-03 19:28:42 -0800212 $("#packages-nav").css({height:parseInt(resizePackagesNav.css("height")) - 6 + "px"}); //move 6px for handle
Scott Main3f7d1df2009-11-02 15:31:04 -0800213
Dirk Doughertyc13d0452009-07-08 14:39:31 -0700214 var basePath = getBaseUri(location.pathname);
215 var section = basePath.substring(1,basePath.indexOf("/",1));
Dirk Dougherty4405a232009-07-07 17:43:27 -0700216 writeCookie("height", resizePackagesNav.css("height"), section, null);
The Android Open Source Project88b60792009-03-03 19:28:42 -0800217}
218
Scott Main3f7d1df2009-11-02 15:31:04 -0800219/* Resize the height of the side-nav and doc-content divs,
220 * which creates the frame effect */
221function resizeHeight() {
222 // Get the window height and always resize the doc-content and side-nav divs
223 var windowHeight = ($(window).height() - HEADER_HEIGHT);
224 content.css({height:windowHeight + "px"});
225 sidenav.css({height:windowHeight + "px"});
226
227 var href = location.href;
228 // If in the reference docs, also resize the "swapper", "classes-nav", and "nav-tree" divs
229 if (href.indexOf("/reference/") != -1) {
230 var swapperHeight = windowHeight - 13;
231 $("#swapper").css({height:swapperHeight + "px"});
232 $("#classes-nav").css({height:swapperHeight - parseInt(resizePackagesNav.css("height")) + "px"});
233 $("#nav-tree").css({height:swapperHeight + "px"});
234
235 // If in the dev guide docs, also resize the "devdoc-nav" div
236 } else if (href.indexOf("/guide/") != -1) {
237 $("#devdoc-nav").css({height:sidenav.css("height")});
Dirk Dougherty502c4982009-12-02 18:01:16 -0800238 } else if (href.indexOf("/resources/") != -1) {
239 $("#devdoc-nav").css({height:sidenav.css("height")});
Scott Main3f7d1df2009-11-02 15:31:04 -0800240 }
241}
242
243/* Resize the width of the "side-nav" and the left margin of the "doc-content" div,
244 * which creates the resizable side bar */
The Android Open Source Project88b60792009-03-03 19:28:42 -0800245function resizeWidth() {
246 var windowWidth = $(window).width() + "px";
247 if (sidenav.length) {
248 var sidenavWidth = sidenav.css("width");
249 } else {
250 var sidenavWidth = 0;
251 }
Scott Main3f7d1df2009-11-02 15:31:04 -0800252 content.css({marginLeft:parseInt(sidenavWidth) + 6 + "px"}); //account for 6px-wide handle-bar
253
254 if (isIE6) {
255 content.css({width:parseInt(windowWidth) - parseInt(sidenavWidth) - 6 + "px"}); // necessary in order to for scrollbars to be visible
256 }
257
The Android Open Source Project88b60792009-03-03 19:28:42 -0800258 resizePackagesNav.css({width:sidenavWidth});
259 classesNav.css({width:sidenavWidth});
260 $("#packages-nav").css({width:sidenavWidth});
Scott Main3f7d1df2009-11-02 15:31:04 -0800261
Dirk Doughertyc13d0452009-07-08 14:39:31 -0700262 var basePath = getBaseUri(location.pathname);
263 var section = basePath.substring(1,basePath.indexOf("/",1));
Dirk Dougherty4405a232009-07-07 17:43:27 -0700264 writeCookie("width", sidenavWidth, section, null);
The Android Open Source Project88b60792009-03-03 19:28:42 -0800265}
266
Scott Main3f7d1df2009-11-02 15:31:04 -0800267/* For IE6 only,
268 * because it can't properly perform auto width for "doc-content" div,
269 * avoiding this for all browsers provides better performance */
The Android Open Source Project88b60792009-03-03 19:28:42 -0800270function resizeAll() {
Scott Main3f7d1df2009-11-02 15:31:04 -0800271 resizeHeight();
272 resizeWidth();
The Android Open Source Project88b60792009-03-03 19:28:42 -0800273}
274
Dirk Dougherty4405a232009-07-07 17:43:27 -0700275function getBaseUri(uri) {
Dirk Doughertyefdcda42009-07-15 16:41:48 -0700276 var intlUrl = (uri.substring(0,6) == "/intl/");
Dirk Dougherty4405a232009-07-07 17:43:27 -0700277 if (intlUrl) {
278 base = uri.substring(uri.indexOf('intl/')+5,uri.length);
279 base = base.substring(base.indexOf('/')+1, base.length);
280 //alert("intl, returning base url: /" + base);
281 return ("/" + base);
282 } else {
283 //alert("not intl, returning uri as found.");
284 return uri;
285 }
286}
287
Dirk Doughertyefdcda42009-07-15 16:41:48 -0700288function requestAppendHL(uri) {
289//append "?hl=<lang> to an outgoing request (such as to blog)
290 var lang = getLangPref();
291 if (lang) {
292 var q = 'hl=' + lang;
293 uri += '?' + q;
294 window.location = uri;
295 return false;
296 } else {
297 return true;
298 }
299}
300
The Android Open Source Project88b60792009-03-03 19:28:42 -0800301function loadLast(cookiePath) {
302 var location = window.location.href;
303 if (location.indexOf("/"+cookiePath+"/") != -1) {
304 return true;
305 }
Dirk Dougherty4405a232009-07-07 17:43:27 -0700306 var lastPage = readCookie(cookiePath + "_lastpage");
The Android Open Source Project88b60792009-03-03 19:28:42 -0800307 if (lastPage) {
308 window.location = lastPage;
309 return false;
310 }
311 return true;
312}
313
314$(window).unload(function(){
Dirk Dougherty4405a232009-07-07 17:43:27 -0700315 var path = getBaseUri(location.pathname);
316 if (path.indexOf("/reference/") != -1) {
317 writeCookie("lastpage", path, "reference", null);
318 } else if (path.indexOf("/guide/") != -1) {
319 writeCookie("lastpage", path, "guide", null);
Dirk Dougherty502c4982009-12-02 18:01:16 -0800320 } else if (path.indexOf("/resources/") != -1) {
321 writeCookie("lastpage", path, "resources", null);
The Android Open Source Project88b60792009-03-03 19:28:42 -0800322 }
323});
324
The Android Open Source Project88b60792009-03-03 19:28:42 -0800325function toggle(obj, slide) {
326 var ul = $("ul", obj);
327 var li = ul.parent();
328 if (li.hasClass("closed")) {
329 if (slide) {
330 ul.slideDown("fast");
331 } else {
332 ul.show();
333 }
334 li.removeClass("closed");
335 li.addClass("open");
336 $(".toggle-img", li).attr("title", "hide pages");
337 } else {
338 ul.slideUp("fast");
339 li.removeClass("open");
340 li.addClass("closed");
341 $(".toggle-img", li).attr("title", "show pages");
342 }
343}
344
The Android Open Source Project88b60792009-03-03 19:28:42 -0800345function buildToggleLists() {
346 $(".toggle-list").each(
347 function(i) {
348 $("div", this).append("<a class='toggle-img' href='#' title='show pages' onClick='toggle(this.parentNode.parentNode, true); return false;'></a>");
349 $(this).addClass("closed");
350 });
351}
352
353function getNavPref() {
Dirk Dougherty4405a232009-07-07 17:43:27 -0700354 var v = readCookie('reference_nav');
The Android Open Source Project88b60792009-03-03 19:28:42 -0800355 if (v != NAV_PREF_TREE) {
356 v = NAV_PREF_PANELS;
357 }
358 return v;
359}
360
361function chooseDefaultNav() {
362 nav_pref = getNavPref();
363 if (nav_pref == NAV_PREF_TREE) {
364 $("#nav-panels").toggle();
365 $("#panel-link").toggle();
366 $("#nav-tree").toggle();
367 $("#tree-link").toggle();
368 }
369}
370
371function swapNav() {
372 if (nav_pref == NAV_PREF_TREE) {
373 nav_pref = NAV_PREF_PANELS;
374 } else {
375 nav_pref = NAV_PREF_TREE;
Dirk Dougherty3b1ee372009-07-29 12:25:44 -0700376 init_default_navtree(toRoot);
The Android Open Source Project88b60792009-03-03 19:28:42 -0800377 }
378 var date = new Date();
379 date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years
Dirk Dougherty4405a232009-07-07 17:43:27 -0700380 writeCookie("nav", nav_pref, "reference", date.toGMTString());
The Android Open Source Project88b60792009-03-03 19:28:42 -0800381
382 $("#nav-panels").toggle();
383 $("#panel-link").toggle();
384 $("#nav-tree").toggle();
385 $("#tree-link").toggle();
386
387 if ($("#nav-tree").is(':visible')) scrollIntoView("nav-tree");
388 else {
389 scrollIntoView("packages-nav");
390 scrollIntoView("classes-nav");
391 }
392}
393
394function scrollIntoView(nav) {
395 var navObj = $("#"+nav);
396 if (navObj.is(':visible')) {
397 var selected = $(".selected", navObj);
398 if (selected.length == 0) return;
399 if (selected.is("div")) selected = selected.parent();
400
401 var scrolling = document.getElementById(nav);
402 var navHeight = navObj.height();
403 var offsetTop = selected.position().top;
404 if (selected.parent().parent().is(".toggle-list")) offsetTop += selected.parent().parent().position().top;
405 if(offsetTop > navHeight - 92) {
406 scrolling.scrollTop = offsetTop - navHeight + 92;
407 }
408 }
409}
410
411function toggleAllInherited(linkObj, expand) {
412 var a = $(linkObj);
413 var table = $(a.parent().parent().parent());
414 var expandos = $(".jd-expando-trigger", table);
415 if ( (expand == null && a.text() == "[Expand]") || expand ) {
416 expandos.each(function(i) {
417 toggleInherited(this, true);
418 });
419 a.text("[Collapse]");
420 } else if ( (expand == null && a.text() == "[Collapse]") || (expand == false) ) {
421 expandos.each(function(i) {
422 toggleInherited(this, false);
423 });
424 a.text("[Expand]");
425 }
426 return false;
427}
428
429function toggleAllSummaryInherited(linkObj) {
430 var a = $(linkObj);
431 var content = $(a.parent().parent().parent());
432 var toggles = $(".toggle-all", content);
433 if (a.text() == "[Expand All]") {
434 toggles.each(function(i) {
435 toggleAllInherited(this, true);
436 });
437 a.text("[Collapse All]");
438 } else {
439 toggles.each(function(i) {
440 toggleAllInherited(this, false);
441 });
442 a.text("[Expand All]");
443 }
444 return false;
445}
Dirk Dougherty4405a232009-07-07 17:43:27 -0700446
447
448function changeTabLang(lang) {
449 var nodes = $("#header-tabs").find("."+lang);
450 for (i=0; i < nodes.length; i++) { // for each node in this language
451 var node = $(nodes[i]);
452 node.siblings().css("display","none"); // hide all siblings
453 if (node.not(":empty").length != 0) { //if this languages node has a translation, show it
454 node.css("display","inline");
455 } else { //otherwise, show English instead
456 node.css("display","none");
457 node.siblings().filter(".en").css("display","inline");
458 }
459 }
460}
461
462function changeNavLang(lang) {
463 var nodes = $("#side-nav").find("."+lang);
464 for (i=0; i < nodes.length; i++) { // for each node in this language
465 var node = $(nodes[i]);
466 node.siblings().css("display","none"); // hide all siblings
467 if (node.not(":empty").length != 0) { // if this languages node has a translation, show it
468 node.css("display","inline");
469 } else { // otherwise, show English instead
470 node.css("display","none");
471 node.siblings().filter(".en").css("display","inline");
472 }
473 }
474}
475
476function changeDocLang(lang) {
477 changeTabLang(lang);
478 changeNavLang(lang);
479}
480
481function changeLangPref(lang, refresh) {
482 var date = new Date();
483 expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000))); // keep this for 50 years
484 //alert("expires: " + expires)
485 writeCookie("pref_lang", lang, null, expires);
486 //changeDocLang(lang);
487 if (refresh) {
488 l = getBaseUri(location.pathname);
489 window.location = l;
490 }
491}
492
493function loadLangPref() {
494 var lang = readCookie("pref_lang");
495 if (lang != 0) {
496 $("#language").find("option[value='"+lang+"']").attr("selected",true);
497 }
498}
499
500function getLangPref() {
Dirk Doughertyefdcda42009-07-15 16:41:48 -0700501 var lang = $("#language").find(":selected").attr("value");
502 if (!lang) {
503 lang = readCookie("pref_lang");
504 }
505 return (lang != 0) ? lang : 'en';
Dirk Dougherty4405a232009-07-07 17:43:27 -0700506}
Scott Main462cc372009-10-23 16:19:37 -0700507
508
509function toggleContent(obj) {
510 var button = $(obj);
511 var div = $(obj.parentNode);
512 var toggleMe = $(".toggle-content-toggleme",div);
513 if (button.hasClass("show")) {
514 toggleMe.slideDown();
515 button.removeClass("show").addClass("hide");
516 } else {
517 toggleMe.slideUp();
518 button.removeClass("hide").addClass("show");
519 }
520 $("span", button).toggle();
521}