/*
 *  Copyright (c) 2010 Healthcommunities.com, Inc.
 *  All rights reserved
 *  Please contact us at http://practice.healthcommunities.com/ for information
 *  regarding use of this code and medical website design.
 */

(function($){ltIE8=($.browser.msie&&$.browser.version<8)?true:false;ltIE7=($.browser.msie&&$.browser.version<7)?true:false;$.fn.hcFeaturebox=function(a){var b={trigger:'a',target:'',over:activate,showCSS:{opacity:'show'},showSpeed:800,showFX:'swing',hideCSS:{opacity:'hide'},hideSpeed:400,hideFX:'swing'};var c=$.extend({},b,a);var d,$target;this.each(function(){d=$('.legend',this);$target=c.target?$(c.target):$('.frame',this);$(c.trigger,d).each(function(i){$(this).mouseover(function(){c.over.call($(this),i)})})});function activate(i){if(!this.hasClass('hover')){$('.hover',d).removeClass('hover');this.addClass('hover');$('.active',$target).removeClass('active').css('z-index',0).animate(c.hideCSS,c.hideSpeed,c.hideFX);$(':eq('+i+')',$target).addClass('active').css('z-index',1).animate(c.showCSS,c.showSpeed,c.showFX)}}};$.fn.hcMenu=function(d){var e={sensitivity:2,interval:50,timeout:200,over:showMenu,out:hideMenu,showCSS:{height:'show'},showSpeed:0,showFX:'swing',hideCSS:{height:'hide'},hideSpeed:0,hideFX:'swing',arrowsA:false,arrowsB:false};if(d.accordion)$.extend(e,{over:function(){},showSpeed:'slow',hideSpeed:'slow',timeout:1000});var f=$.extend({},e,d);function showMenu(){$(this).parent().find('li.hover').each(function(){$(this).removeClass('hover').find('ul:first').css({visibility:'hidden'})}).end().end().addClass('hover');$('ul:first',this).css({visibility:'visible'}).stop(true,true).animate(f.showCSS,f.showSpeed,f.showFX)};function hideMenu(){if(f.accordion){$(this).find('li.active:not(.pagemenu)').removeClass('active').find('ul:first').animate(f.hideCSS,f.hideSpeed,f.hideFX).end().end().find('li.pagemenu:not(.active)').addClass('active').find('ul:first').animate(f.showCSS,f.showSpeed,f.showFX)}else{$(this).removeClass('hover').find('ul:first',this).stop(true,true).animate(f.hideCSS,f.hideSpeed,f.hideFX)}};function menuClick(c){$('> li:not(:has(ul)) > a',c).each(function(){var a=$(this).text();$(this).attr('title',"Go to the "+a+" page")});$('> li:has(ul) > a',c).each(function(){var b=$(this),txt=b.text();b.attr('title',"Show/Hide the "+txt+" menu");b.click(function(a){a.preventDefault();$li=$(this).parent();$li.addClass('click').parent().find('li.active ul').animate(f.hideCSS,f.hideSpeed,f.hideFX).end().find('li.active:not(.click)').removeClass('active');$li.toggleClass('active click').parent().find('li.active ul').animate(f.showCSS,f.showSpeed,f.showFX)})})};this.each(function(){if(f.accordion&&!ltIE7){var a=location.pathname.split('/');if(a=a[a.length-1]){$('> li:has(a[href$="'+a+'"])',this).addClass('pagemenu active').find('ul:first').animate(f.showCSS,f.showSpeed,f.showFX);if($.fn.hoverIntent)$(this).hoverIntent(f);else $(this).mouseout(hideMenu)}menuClick(this)}else if(f.accordion&&ltIE7){$('> li',this).hover(function(){$(this).addClass('active')},function(){$(this).removeClass('active')})}else{$('ul',this).css({display:'none'});if($.fn.hoverIntent)$(ltIE7?'li':'li:has(ul)',this).hoverIntent(f);else $(ltIE7?'li':'li:has(ul)',this).hover(showMenu,hideMenu)}if(f.arrowsA){f.arrowsA=f.accordion?(ltIE7?'':(typeof f.arrowsA==='string'?f.arrowsA:"&nbsp;&nbsp;&darr;")):(typeof f.arrowsA==='string'?f.arrowsA:"&nbsp;&nbsp;&raquo;");$('>li:has(ul)',this).find('a:first').append(typeof f.arrowsA==='string'?f.arrowsA:"&nbsp;&nbsp;&raquo;")}if(f.arrowsB)$('li ul li:has(ul)',this).find('a:first').append(typeof f.arrowsB==='string'?f.arrowsB:"&nbsp;&nbsp;&raquo;")});return this};$.fn.hcTextSlide=function(d){if(typeof d=='undefined')var d=1500;setSpeed(d);function setSpeed(v){switch(v){case'fast':d=1000;break;case'slow':d=2000;break;default:if(v=v*1)d=v}};this.each(function(){var b=$(this).attr('class').split(' ');if(b[0]!=''){for(var i in b){var c=b[i];setSpeed(c)}}$(this).find('span').each(function(i){var a=$(this);setTimeout(function(){a.animate({left:0},d)},d/2*i)})});return this};$.fn.hcImgCycle=function(e){if(typeof e=='undefined')var e={};var f={};var g={};var h;var j;var k=['flip','spin','cube','blindX','blindY','blindZ','cover','curtainX','curtainY','fade','fadeZoom','growX','growY','none','scrollUp','scrollDown','scrollLeft','scrollRight','scrollHorz','scrollVert','shuffle','slideX','slideY','toss','turnUp','turnDown','turnLeft','turnRight','uncover','wipe','zoom'];k=k.join(' ');function hcFX(a){switch(a){case'flip':return{'fx':'curtainY','speed':800,'timeout':800,'random':0,'sync':0,'pause':3000};case'spin':return{'fx':'curtainX','speed':800,'timeout':800,'random':0,'sync':0,'pause':3000};case'cube':return{'fx':'turnUp','speed':1200,'timeout':1500,'random':0,'pause':3000};default:return{'fx':(k.indexOf(a)>14)?a:'fade','speed':1600,'timeout':2000,'random':0,'pause':1200}}};function setSpeed(a){switch(a.speed){case'fast':a.speed=f.speed/2;if(!a.group)a.timeout=f.timeout/2;break;case'slow':a.speed=f.speed*1.5;if(!a.group)a.timeout=f.timeout*1.5}return a};this.each(function(){f=hcFX(e.effect);$.extend(f,e,setSpeed(e));g=$.extend({},f);fx_via_class($(this));h=g.group=$(this).children('div').has('img').length;j=$('div:first img',this).length;if(!g.group){applyFX($(this))}else{f=$.extend({},g);$(this).children('div').has('img').each(function(i){g=$.extend({},f);fx_via_class($(this));g.pause=f.pause;applyFX($(this),i)})}});function fx_via_class(a){var b=a.attr('class').split(' ');if(b[0]!=''){for(var i in b){var c=b[i];if(k.indexOf(c)!=-1){g.group?g.fx=c:$.extend(g,hcFX(c))}else if(c=='fast'||c=='slow'){g.speed=c;$.extend(g,setSpeed(g))}else if(c=c*1){g.speed=c;g.timeout=(typeof b[i+1]=='integer')?b[i+1]:c}}}};function applyFX(a,i){if(typeof i=='undefined')i=1;h=h?h:1;var b=g.timeout;var c=g.pause;var d={fx:g.fx,speed:g.speed,delay:-b*(h-i),timeout:b*h+(c||0),random:g.random,sync:g.sync,autostop:g.autostop||0,autostopCount:j+1,end:g.end};a.cycle(d)};return this}})(jQuery);
