//Accordion Content script: By Dynamic Drive, at http://www.dynamicdrive.com //Created: Jan 7th, 08' var ddaccordion={ contentclassname:{}, //object to store corresponding contentclass name based on headerclass expandone:function(headerclass, selected){ //PUBLIC function to expand a particular header this.toggleone(headerclass, selected, "expand") }, collapseone:function(headerclass, selected){ //PUBLIC function to collapse a particular header this.toggleone(headerclass, selected, "collapse") }, expandall:function(headerclass){ //PUBLIC function to expand all headers based on their shared CSS classname var _$headers=_$('.'+headerclass) _$('.'+this.contentclassname[headerclass]+':hidden').each(function(){ _$headers.eq(parseInt(_$(this).attr('contentindex'))).click() }) }, collapseall:function(headerclass){ //PUBLIC function to collapse all headers based on their shared CSS classname var _$headers=_$('.'+headerclass) _$('.'+this.contentclassname[headerclass]+':visible').each(function(){ _$headers.eq(parseInt(_$(this).attr('contentindex'))).click() }) }, toggleone:function(headerclass, selected, optstate){ //PUBLIC function to expand/ collapse a particular header var _$targetHeader=_$('.'+headerclass).eq(selected) var _$subcontent=_$('.'+this.contentclassname[headerclass]).eq(selected) if (typeof optstate=="undefined" || optstate=="expand" && _$subcontent.is(":hidden") || optstate=="collapse" && _$subcontent.is(":visible")) _$targetHeader.click() }, expandit:function(_$targetHeader, _$targetContent, config){ _$targetContent.slideDown(config.animatespeed) this.transformHeader(_$targetHeader, config, "expand") }, collapseit:function(_$targetHeader, _$targetContent, config){ _$targetContent.slideUp(config.animatespeed) this.transformHeader(_$targetHeader, config, "collapse") }, transformHeader:function(_$targetHeader, config, state){ _$targetHeader.addClass((state=="expand")? config.cssclass.expand : config.cssclass.collapse) //alternate btw "expand" and "collapse" CSS classes .removeClass((state=="expand")? config.cssclass.collapse : config.cssclass.expand) if (config.htmlsetting.location=='src'){ //Change header image (assuming header is an image)? _$targetHeader=(_$targetHeader.is("img"))? _$targetHeader : _$targetHeader.find('img').eq(0) //Set target to either header itself, or first image within header _$targetHeader.attr('src', (state=="expand")? config.htmlsetting.expand : config.htmlsetting.collapse) //change header image } else if (config.htmlsetting.location=="prefix") //if change "prefix" HTML, locate dynamically added ".accordprefix" span tag and change it _$targetHeader.find('.accordprefix').html((state=="expand")? config.htmlsetting.expand : config.htmlsetting.collapse) else if (config.htmlsetting.location=="suffix") _$targetHeader.find('.accordsuffix').html((state=="expand")? config.htmlsetting.expand : config.htmlsetting.collapse) }, getCookie:function(Name){ var re=new RegExp(Name+"=[^;]+", "i") //construct RE to search for target name/value pair if (document.cookie.match(re)) //if cookie found return document.cookie.match(re)[0].split("=")[1] //return its value return null }, setCookie:function(name, value){ document.cookie = name + "=" + value }, init:function(config){ document.write('