var toggleBinaryGlobal="10000000000000000000000000000000000000000000000000000";var thesparezeros="00000000000000000000000000";var thewwwroot;var thecookiesubid;var yuicookie=YAHOO.util.Cookie;var numToggles;function topcoll_init(d,a,c){thewwwroot=d;thecookiesubid=a+c;var b=document.createElement("link");b.setAttribute("rel","stylesheet");b.setAttribute("type","text/css");b.setAttribute("href",""+thewwwroot+"/course/format/topcoll/js-override-topcoll.css");document.getElementsByTagName("head")[0].appendChild(b)}function set_number_of_toggles(a){numToggles=a}function togglebinary(c,b){if((c>=1)&&(c<=52)){var e=toggleBinaryGlobal.substring(0,c);var a=toggleBinaryGlobal.substring(c+1);var d=e+b+a;toggleBinaryGlobal=d;save_toggles()}}function toggleexacttopic(e,d,c,b){if(document.getElementById){if(navigator.userAgent.indexOf("IE")!=-1){var a="block"}else{var a="table-row"}if(e.style.display==a){e.style.display="none";d.style.backgroundImage="url("+thewwwroot+"/course/format/topcoll/arrow_down.png)";if(b==false){togglebinary(c,"0")}}else{e.style.display=a;d.style.backgroundImage="url("+thewwwroot+"/course/format/topcoll/arrow_up.png)";if(b==false){togglebinary(c,"1")}}}}function toggle_topic(b,a){if(document.getElementById){imageSwitch=b;targetElement=b.parentNode.parentNode.nextSibling;if(targetElement.className==undefined){targetElement=b.parentNode.parentNode.nextSibling.nextSibling}toggleexacttopic(targetElement,imageSwitch,a,false)}}function to2baseString(c){var e=parseInt(c.substring(0,6),36);var b=parseInt(c.substring(6,12),36);var d=e.toString(2);var a=b.toString(2);if(d.length<26){d=thesparezeros.substring(0,(26-d.length))+d}if(a.length<27){a=thesparezeros.substring(0,(27-a.length))+a}return d+a}function to36baseString(b){var e=parseInt(b.substring(0,26),2);var c=parseInt(b.substring(26,53),2);var d=e.toString(36);var a=c.toString(36);if(d.length<6){d=thesparezeros.substring(0,(6-d.length))+d}if(a.length<6){a=thesparezeros.substring(0,(6-a.length))+a}return d+a}function savetopcollcookie(a){yuicookie.setSub("mdl_cf_topcoll",thecookiesubid,a)}function restoretopcollcookie(){return yuicookie.getSub("mdl_cf_topcoll",thecookiesubid)}function reload_toggles(){var b=restoretopcollcookie();if(b!=null){toggleBinaryGlobal=to2baseString(b)}for(var a=1;a<=numToggles;a++){if((a<=numToggles)&&(toggleBinaryGlobal.charAt(a)=="1")){toggleexacttopic(document.getElementById("section-"+a),document.getElementById("sectionatag-"+a),a,true)}}}function save_toggles(){savetopcollcookie(to36baseString(toggleBinaryGlobal))};
