var switchcontent_ajax_msg="<em>Loading content...</em>";var switchcontent_ajax_bustcache=true;function switchcontent(b,a){this.className=b;this.collapsePrev=false;this.persistType="none";this.filter_content_tag=(typeof a!="undefined")?a.toLowerCase():"";this.ajaxheaders={}}switchcontent.prototype.setStatus=function(b,a){this.statusOpen=b;this.statusClosed=a};switchcontent.prototype.setColor=function(a,b){this.colorOpen=a;this.colorClosed=b};switchcontent.prototype.setPersist=function(a,b){if(a==true){if(typeof b=="undefined"){this.persistType="session"}else{this.persistType="days";this.persistDays=parseInt(b)}}else{this.persistType="none"}};switchcontent.prototype.collapsePrevious=function(a){this.collapsePrev=a};switchcontent.prototype.setContent=function(a,b){this.ajaxheaders["header"+a]=b};switchcontent.prototype.sweepToggle=function(b){if(typeof this.headers!="undefined"&&this.headers.length>0){for(var a=0;a<this.headers.length;a++){if(b=="expand"){this.expandcontent(this.headers[a])}else{if(b=="contract"){this.contractcontent(this.headers[a])}}}}};switchcontent.prototype.defaultExpanded=function(){var b=[];for(var a=0;(!this.collapsePrev&&a<arguments.length)||(this.collapsePrev&&a==0);a++){b[b.length]=arguments[a]}this.expandedindices=b.join(",")};switchcontent.prototype.togglecolor=function(b,a){if(typeof this.colorOpen!="undefined"){b.style.color=a}};switchcontent.prototype.togglestatus=function(b,a){if(typeof this.statusOpen!="undefined"){b.firstChild.innerHTML=a}};switchcontent.prototype.contractcontent=function(b){var a=document.getElementById(b.id.replace("-title",""));a.style.display="none";this.togglestatus(b,this.statusClosed);this.togglecolor(b,this.colorClosed)};switchcontent.prototype.expandcontent=function(b){var a=document.getElementById(b.id.replace("-title",""));if(b.ajaxstatus=="waiting"){switchcontent.connect(b.ajaxfile,b)}a.style.display="block";this.togglestatus(b,this.statusOpen);this.togglecolor(b,this.colorOpen)};switchcontent.prototype.toggledisplay=function(b){var a=document.getElementById(b.id.replace("-title",""));if(a.style.display=="block"){this.contractcontent(b)}else{this.expandcontent(b);if(this.collapsePrev&&typeof this.prevHeader!="undefined"&&this.prevHeader.id!=b.id){this.contractcontent(this.prevHeader)}}if(this.collapsePrev){this.prevHeader=b}};switchcontent.prototype.collectElementbyClass=function(c){var d=new RegExp("(^|\\s+)"+c+"($|\\s+)","i");this.headers=[],this.innercontents=[];if(this.filter_content_tag!=""){var b=document.getElementsByTagName(this.filter_content_tag)}else{var b=document.all?document.all:document.getElementsByTagName("*")}for(var a=0;a<b.length;a++){if(typeof b[a].className=="string"&&b[a].className.search(d)!=-1){if(document.getElementById(b[a].id+"-title")!=null){this.headers[this.headers.length]=document.getElementById(b[a].id+"-title");this.innercontents[this.innercontents.length]=b[a]}}}};switchcontent.prototype.init=function(){var b=this;this.collectElementbyClass(this.className);if(this.headers.length==0){return}if(this.persistType=="days"&&(parseInt(switchcontent.getCookie(this.className+"_dtrack"))!=this.persistDays)){switchcontent.setCookie(this.className+"_d","",-1)}var c=(this.persistType=="session"&&switchcontent.getCookie(this.className)!="")?","+switchcontent.getCookie(this.className)+",":(this.persistType=="days"&&switchcontent.getCookie(this.className+"_d")!="")?","+switchcontent.getCookie(this.className+"_d")+",":(this.expandedindices)?","+this.expandedindices+",":"";for(var a=0;a<this.headers.length;a++){if(typeof this.ajaxheaders["header"+a]!="undefined"){this.headers[a].ajaxstatus="waiting";this.headers[a].ajaxfile=this.ajaxheaders["header"+a]}if(typeof this.statusOpen!="undefined"){this.headers[a].innerHTML='<span class="status"></span>'+this.headers[a].innerHTML}if(c.indexOf(","+a+",")!=-1){this.expandcontent(this.headers[a]);if(this.collapsePrev){this.prevHeader=this.headers[a]}}else{this.contractcontent(this.headers[a])}this.headers[a].onclick=function(){b.toggledisplay(this)}}switchcontent.dotask(window,function(){b.rememberpluscleanup()},"unload")};switchcontent.prototype.rememberpluscleanup=function(){var b=new Array("none");for(var a=0;a<this.innercontents.length;a++){if(this.persistType!="none"&&this.innercontents[a].style.display=="block"&&(!this.collapsePrev||(this.collapsePrev&&b.length<2))){b[b.length]=a}this.headers[a].onclick=null}if(b.length>1){b.shift()}if(typeof this.statusOpen!="undefined"){this.statusOpen=this.statusClosed=null}if(this.persistType=="session"){switchcontent.setCookie(this.className,b.join(","))}else{if(this.persistType=="days"&&typeof this.persistDays=="number"){switchcontent.setCookie(this.className+"_d",b.join(","),this.persistDays);switchcontent.setCookie(this.className+"_dtrack",this.persistDays,this.persistDays)}}};switchcontent.dotask=function(b,c,a){var a=(window.addEventListener)?a:"on"+a;if(b.addEventListener){b.addEventListener(a,c,false)}else{if(b.attachEvent){b.attachEvent(a,c)}}};switchcontent.connect=function(a,f){var d=false;var c="";if(window.ActiveXObject){try{d=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){try{d=new ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}}else{if(window.XMLHttpRequest){d=new XMLHttpRequest()}else{return false}}d.onreadystatechange=function(){switchcontent.loadpage(d,f)};if(switchcontent_ajax_bustcache){c=(a.indexOf("?")!=-1)?"&"+new Date().getTime():"?"+new Date().getTime()}d.open("GET",a+c,true);d.send(null)};switchcontent.loadpage=function(c,b){var a=document.getElementById(b.id.replace("-title",""));a.innerHTML=switchcontent_ajax_msg;if(c.readyState==4&&(c.status==200||window.location.href.indexOf("http")==-1)){a.innerHTML=c.responseText;b.ajaxstatus="loaded"}};switchcontent.getCookie=function(a){var b=new RegExp(a+"=[^;]+","i");if(document.cookie.match(b)){return document.cookie.match(b)[0].split("=")[1]}return""};switchcontent.setCookie=function(b,c,e){if(typeof e!="undefined"){var a=new Date();var d=a.setDate(a.getDate()+e);document.cookie=b+"="+c+"; expires="+a.toGMTString()}else{document.cookie=b+"="+c}};
