function collapse_init(){jQuery('.force_content_collapse').each(function(index){jQuery(this).css('display','none');});jQuery('.collapseomatic:not(.colomat-close)').each(function(index){var thisid=jQuery(this).attr('id');jQuery('#target-'+thisid).css('display','none');});jQuery('.collapseomatic.colomat-close').each(function(index){var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,"#swap-"+thisid);} if(jQuery("#swapexcerpt-"+thisid).length>0){swapTitle("#excerpt-"+thisid,"#swapexcerpt-"+thisid);}});} function swapTitle(origObj,swapObj){var orightml=jQuery(origObj).html();var swaphtml=jQuery(swapObj).html();jQuery(origObj).html(swaphtml);jQuery(swapObj).html(orightml);if(swaphtml.indexOf("0){swapTitle(this,"#swap-"+id);} if(jQuery("#swapexcerpt-"+id).length>0){swapTitle("#exerpt-"+id,"#swapexcerpt-"+id);} toggleState(jQuery(this),id,false,false);var ancestors=jQuery('.collapseomatic','#target-'+id);ancestors.each(function(index){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');jQuery('#target-'+thisid).css('display','none');})}});} function closeOtherMembers(rel,id){jQuery('.collapseomatic[rel="'+rel+'"]').each(function(index){if(jQuery(this).hasClass('colomat-expand-only')&&jQuery(this).hasClass('colomat-close')){return;} if(jQuery(this).attr('id')!=id&&jQuery(this).hasClass('colomat-close')&&jQuery(this).attr('rel')!==undefined){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,"#swap-"+thisid);} if(jQuery("#swapexcerpt-"+thisid).length>0){swapTitle("#excerpt-"+thisid,"#swapexcerpt-"+thisid);} if(!jQuery(this).hasClass('colomat-close')&&jQuery(this).hasClass('snap-shut')){jQuery('#target-'+thisid).hide();} else{toggleState(jQuery(this),thisid,false,false);} var ancestors=jQuery('.collapseomatic','#target-'+id);ancestors.each(function(index){if(jQuery(this).hasClass('colomat-expand-only')&&jQuery(this).hasClass('colomat-close')){return;} var pre_id=id.split('-');if(pre_id[0].indexOf('extra')!='-1'){pre=pre_id.splice(0,1);id=pre_id.join('-');if(jQuery(this).hasClass('scroll-to-trigger')){var target_offset=jQuery('#'+id).offset();offset_top=target_offset.top;} if(jQuery('#'+id).hasClass('scroll-to-trigger')){offset_top=jQuery('#scrollonclose-'+id).attr('name');if(offset_top=='auto'){var target_offset=jQuery('#'+id).offset();offset_top=target_offset.top;}} jQuery('#'+id).toggleClass('colomat-close');jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');} if(jQuery(this).attr('id').indexOf('bot-')=='-1'){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,"#swap-"+thisid);} if(jQuery("#swapexcerpt-"+thisid).length>0){swapTitle("#excerpt-"+thisid,"#swapexcerpt-"+thisid);} jQuery('#target-'+thisid).css('display','none');}})}});} function colomat_expandall(loop_items){if(!loop_items){loop_items=jQuery('.collapseomatic:not(.colomat-close)');} loop_items.each(function(index){jQuery(this).addClass('colomat-close');var thisid=jQuery(this).attr('id');jQuery('#parent-'+thisid).addClass('colomat-parent-highlight');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,"#swap-"+thisid);} if(jQuery("#swapexcerpt-"+thisid).length>0){swapTitle("#excerpt-"+thisid,"#swapexcerpt-"+thisid);} toggleState(jQuery(this),thisid,false,false);});} function colomat_collapseall(loop_items){if(!loop_items){loop_items=jQuery('.collapseomatic.colomat-close');} loop_items.each(function(index){if(jQuery(this).hasClass('colomat-expand-only')&&jQuery(this).hasClass('colomat-close')){return;} jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,"#swap-"+thisid);} if(jQuery("#swapexcerpt-"+thisid).length>0){swapTitle("#excerpt-"+thisid,"#swapexcerpt-"+thisid);} toggleState(jQuery(this),thisid,false,false);});} jQuery(document).ready(function(){collapse_init();jQuery(document.body).on('post-load',function(){collapse_init();});jQuery('.content_collapse_wrapper').each(function(index){jQuery(this).css('display','inline');});jQuery(document).on({mouseenter:function(){jQuery(this).addClass('colomat-hover');},mouseleave:function(){jQuery(this).removeClass('colomat-hover');},focusin:function(){jQuery(this).addClass('colomat-hover');},focusout:function(){jQuery(this).removeClass('colomat-hover');}},'.collapseomatic');jQuery(document).on('keypress','.collapseomatic',function(event){if(event.which==13){event.currentTarget.click();};});jQuery(document).on('click','.collapseomatic',function(event){var offset_top;if(jQuery(this).hasClass('colomat-expand-only')&&jQuery(this).hasClass('colomat-close')){return;} var id=jQuery(this).attr('id');if(jQuery(this).hasClass('colomat-close')&&jQuery(this).hasClass('scroll-to-trigger')){offset_top=jQuery('#scrollonclose-'+id).attr('name');if(offset_top=='auto'){var target_offset=jQuery('#'+id).offset();offset_top=target_offset.top;}} var id_arr=id.split('-');if(id_arr[0].indexOf('extra')!='-1'){pre=id_arr.splice(0,1);id=id_arr.join('-');if(jQuery(this).hasClass('scroll-to-trigger')){var target_offset=jQuery('#'+id).offset();offset_top=target_offset.top;} if(jQuery('#'+id).hasClass('scroll-to-trigger')){offset_top=jQuery('#scrollonclose-'+id).attr('name');if(offset_top=='auto'){var target_offset=jQuery('#'+id).offset();offset_top=target_offset.top;}} jQuery('#'+id).toggleClass('colomat-close');jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');} else if(id.indexOf('bot-')!='-1'){id=id.substr(4);jQuery('#'+id).toggleClass('colomat-close');if(jQuery(this).hasClass('scroll-to-trigger')){var target_offset=jQuery('#'+id).offset();offset_top=target_offset.top;} if(jQuery('#'+id).hasClass('scroll-to-trigger')){offset_top=jQuery('#scrollonclose-'+id).attr('name');if(offset_top=='auto'){var target_offset=jQuery('#'+id).offset();offset_top=target_offset.top;}}} else{jQuery(this).toggleClass('colomat-close');jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');} if(jQuery("#swap-"+id).length>0){swapTitle(jQuery('#'+id),"#swap-"+id);} if(jQuery("#swapexcerpt-"+id).length>0){swapTitle("#excerpt-"+id,"#swapexcerpt-"+id);} jQuery(this).addClass('colomat-visited');var parentID='parent-'+id;jQuery('#'+parentID).toggleClass('colomat-parent-highlight');if(!jQuery(this).hasClass('colomat-close')&&jQuery(this).hasClass('snap-shut')){jQuery('#target-'+id).hide();} else{toggleState(jQuery(this),id,true,id);} if(jQuery(this).attr('rel')!==undefined){var rel=jQuery(this).attr('rel');if(rel.indexOf('-highlander')!='-1'){closeOtherMembers(rel,id);} else{closeOtherGroups(rel);}} if(offset_top){jQuery('html, body').animate({scrollTop:offset_top},500);}});jQuery(document).on('click','.expandall',function(event){if(jQuery(this).attr('rel')!==undefined){var rel=jQuery(this).attr('rel');var loop_items=jQuery('.collapseomatic:not(.colomat-close)[rel="'+rel+'"]');} else{var loop_items=jQuery('.collapseomatic:not(.colomat-close)');} colomat_expandall(loop_items);});jQuery(document).on('click','.collapseall',function(event){if(jQuery(this).attr('rel')!==undefined){var rel=jQuery(this).attr('rel');var loop_items=jQuery('.collapseomatic.colomat-close[rel="'+rel+'"]');} else{var loop_items=jQuery('.collapseomatic.colomat-close');} colomat_collapseall(loop_items);});var fullurl=document.location.toString();if(fullurl.match('#(?!\!)')){var anchor_arr=fullurl.split(/#(?!\!)/);if(anchor_arr.length>1){junk=anchor_arr.splice(0,1);anchor=anchor_arr.join('#');} else{anchor=anchor_arr[0];} if(jQuery('#'+anchor).length){if(!jQuery('#'+anchor).hasClass('colomat-close')){jQuery('#'+anchor).click();} jQuery('#'+anchor).parents('.collapseomatic_content').each(function(index){parent_arr=jQuery(this).attr('id').split('-');junk=parent_arr.splice(0,1);parent=parent_arr.join('-');jQuery('#'+parent).click();}) if(typeof colomatoffset!=='undefined'){var anchor_offset=jQuery('#'+anchor).offset();colomatoffset=colomatoffset+anchor_offset.top;jQuery('html, body').animate({scrollTop:colomatoffset},50);}}} jQuery(document).on('click','a.expandanchor',function(event){var fullurl=jQuery(this).attr('href');if(fullurl.match('#(?!\!)')){var anchor_arr=fullurl.split(/#(?!\!)/);if(anchor_arr.length>1){junk=anchor_arr.splice(0,1);anchor=anchor_arr.join('#');} else{anchor=anchor_arr[0];} if(jQuery('#'+anchor).length){if(!jQuery('#'+anchor).hasClass('colomat-close')){jQuery('#'+anchor).click();} jQuery('#'+anchor).parents('.collapseomatic_content').each(function(index){parent_arr=jQuery(this).attr('id').split('-');junk=parent_arr.splice(0,1);parent=parent_arr.join('-');if(!jQuery('#'+parent).hasClass('colomat-close')){jQuery('#'+parent).click();}})}}});jQuery(document).on('click','a.colomat-nolink',function(event){event.preventDefault();});});