/* Horizontal Accordion script * Created: Oct 27th, 2009. This notice must stay intact for usage * Author: Dynamic Drive at http://www.dynamicdrive.com/ * Visit http://www.dynamicdrive.com/ for full source code */ var haccordion={ //customize loading message if accordion markup is fetched via Ajax: ajaxloadingmsg: '
', accordioninfo: {}, //class that holds config information of each haccordion instance expandli:function(accordionid, targetli){ var config=haccordion.accordioninfo[accordionid] var $targetli=(typeof targetli=="number")? config.$targetlis.eq(targetli) : (typeof targetli=="string")? jQuery('#'+targetli) : jQuery(targetli) if (typeof config.$lastexpanded!="undefined") //targetli may be an index, ID string, or DOM reference to LI config.$lastexpanded.stop().animate({width:config.paneldimensions.peekw}, config.speed) //contract last opened content $targetli.stop().animate({width:$targetli.data('hpaneloffsetw')}, config.speed) //expand current content config.$lastexpanded=$targetli }, urlparamselect:function(accordionid){ var result=window.location.search.match(new RegExp(accordionid+"=(\\d+)", "i")) //check for "?accordionid=index" in URL if (result!=null) result=parseInt(RegExp.$1)+"" //return value as string so 0 doesn't test for false return result //returns null or index, where index is the desired selected hcontent index }, 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 + "; path=/" }, loadexternal:function($, config){ //function to fetch external page containing the entire accordion content markup var $hcontainer=$('#'+config.ajaxsource.container).html(this.ajaxloadingmsg) $.ajax({ url: config.ajaxsource.path, //path to external content async: true, error:function(ajaxrequest){ $hcontainer.html('Error fetching content.