var Highlighter=new Class({Implements:[Options],options:{autoUnhighlight:true,caseSensitive:false,elements:'*',className:'',onlyWords:false,tag:'span'},initialize:function(options){this.setOptions(options);this.elements=$$(this.options.elements);this.words=[];},highlight:function(words,elements,className){var elements=$$(elements||this.elements);var klass=className||this.options.className;if(words.constructor===String){words=[words];}
if(this.options.autoUnhighlight){this.unhighlight();}
var pattern='('+words.join('|')+')';pattern=this.options.onlyWords?'\\b'+pattern+'\\b':pattern;var regex=new RegExp(pattern,this.options.caseSensitive?'':'i');elements.each(function(el){this.recurse(el,regex,klass);},this);return this;},unhighlight:function(words){if(words.constructor===String){words=[words];}
words.each(function(word){word=(this.options.caseSensitive?word:word.toUpperCase());if(this.words[word]){var elements=$$(this.words[word]);elements.set('class','');elements.each(function(el){var tn=document.createTextNode(el.get('text'));el.getParent().replaceChild(tn,el);});}},this);return this;},recurse:function(node,regex,klass){if(node.nodeType===3){var match=node.data.match(regex);if(match){var highlight=new Element(this.options.tag);highlight.addClass(klass);var wordNode=node.splitText(match.index);wordNode.splitText(match[0].length);var wordClone=wordNode.cloneNode(true);highlight.appendChild(wordClone);wordNode.parentNode.replaceChild(highlight,wordNode);highlight.set('rel',highlight.get('text'));var comparer=highlight.get('text');if(!this.options.caseSensitive){comparer=highlight.get('text').toUpperCase();}
if(!this.words[comparer]){this.words[comparer]=[];}
this.words[comparer].push(highlight);return 1;}}else if((node.nodeType===1&&node.childNodes)&&!/(script|style)/i.test(node.tagName)&&!(node.tagName===this.options.tag.toUpperCase()&&node.className===klass)){for(var i=0;i<node.childNodes.length;i++){i+=this.recurse(node.childNodes[i],regex,klass);}}
return 0;}});function getURLParameter(name){return decodeURIComponent((new RegExp('[?|&]'+name+'='+'([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g,'%20'))||null;}
var action='practitioner';window.addEvent('domready',function(){if(Browser.Platform.ios){$('wrapper').addClass('ios');}
if(Browser.Platform.android){$('wrapper').addClass('android');}
if(Browser.Platform.win){$('wrapper').addClass('win');}
myScroll=new Fx.SmoothScroll({duration:400},window);$$('a[rel="external"], a.external').set('target','_blank');$$('a.email').each(function(el){el.set('href','mailto:'+el.get('data-email').replace('|','@').replace('/',''));});var highlight=getURLParameter('highlight');if(highlight){var highlighter=new Highlighter({elements:'#content',autoUnhighlight:false,className:'highlight'});highlighter.highlight(''+highlight);}
if($('searchkey')){var highlight=$('searchkey').get('html');var highlighter=new Highlighter({elements:'#content',autoUnhighlight:false,className:'highlight'});highlighter.highlight(highlight);}
siteInit();});function siteInit(){$$('.icon-search').addEvent('click',function(){if(!$(this.parentNode).hasClass('open')){$(this.parentNode).addClass('open');if(!Browser.Platform.ios){$('searchinput').focus();}}else{var searchLength=$('searchinput').get('value').length;if(searchLength>5){$('searchform').submit();}else{this.parentNode.removeClass('open');}}});$$('.toggle').addEvent('click',function(){if(this.get('data-action')!==action){$$('#'+action).removeClass('active');$(this.parentNode).removeClass(action);action=this.get('data-action');$$('#'+action).addClass('active');this.parentNode.addClass(action);}});}