/** 
* Hospiz Mitarbeiter Akkordion
**/
function hosAkkordion( sectionID ) 
{	
	var defaultSection = 24;
	$('#hos_accordion div.hos_accordion_content').hide();	
	if ( $("#section" + sectionID).length )
	{
			$("#section" + sectionID).addClass('active');
			$("#section" + sectionID + " div.hos_accordion_content").show();			
			f=true;			
	}else{	
		/*$("#section" + defaultSection).addClass('active');
		$("#section" + defaultSection+ " div.hos_accordion_content").show();*/		
	}
	$('#hos_accordion li h3 a').focus(function(){$(this).blur();});
	$('#hos_accordion li h3 a').click(
		function() {					
			var checkElement = $(this).parent().next();		
			var parentElement = $(this).parent().parent();		
			if((checkElement.is('div')) && (!checkElement.is(':visible'))) {
				$('#hos_accordion li.active').removeClass('active');
				parentElement.addClass('active');
				$('#hos_accordion div.hos_accordion_content:visible').slideUp();				
				checkElement.slideDown();					
			}else{
				parentElement.removeClass('active');checkElement.slideUp();
			}
			return false;
		}
	);
}	


$(window).load(function()
{
	if ( $("body:has(div.hos-fotostrecke)").length != 0 )
	{			
		$.ajaxSetup({ cache: true });
    $.getScript("/_new/extension/ezwebin/design/hospiz/javascript/jquery.prettyPhoto.js", function()
    {
    	$("a[rel^='hospizGallery[]']").prettyPhoto({
				animationSpeed: 'normal',
				padding: 40, 
				opacity: 0.5,
				showTitle: false,
				allowresize: true, 
				counter_separator_label: ' von ',
				theme: 'light_rounded', 
				hideflash: false,
				modal: false,
				changepicturecallback: function(){},
				callback: function(){}
			});  
    });        
    $.ajaxSetup({ cache: false });
	}
});

$(document).ready(function()
{
	$.ajaxSetup({ cache: true });
	
	/** 
	* Hospiz Kalender Akkordion
	**/
	$("div#hospiz-calendar tr.vevent div.description").each(function(){	
		$(this).attr('rel', $(this).height() );
		$(this).not('.open').addClass('closed');		
	});
	$("div#hospiz-calendar a.toptoggle").click(function(){$(this).parent().parent().click();return false;});
	$("div#hospiz-calendar a.toggle").click(function(){$(this).parent().parent().click();return false;});
	$("div#hospiz-calendar tr.vevent.closed").live( "click", function(){	
		var tr = $(this);
		var div = $(tr).find("div.description");
		$(div).parent().find('a.toggle').fadeOut(200);	
		$("div#hospiz-calendar tr.vevent.opened").animate({backgroundColor:'#FFFFFF'},800,function(){$(this).removeAttr('style');});
		$("div#hospiz-calendar tr.vevent.opened div.description").animate({height:'54px'}, 800, function(){
				$(this).css("overflow","hidden");		
				var h = Math.max($(div).attr('rel'),50);						
				$(tr).animate({backgroundColor:'#ece8e2'},800);
				div.animate({height: h}, 800, function(){
					$("div#hospiz-calendar tr.vevent.opened").removeClass("opened").addClass("closed");
					$(tr).removeClass("closed").addClass("opened");					
					if (h>50)$(this).css('height', '100%');				
				});			
				$(this).parent().find('a.toggle').fadeIn();
		});
	});

	if ( $("body:has(ul#hos-banner-slide)").length != 0 )
	{
	
    $.getScript("/_new/extension/ezwebin/design/hospiz/javascript/jquery.innerfade.min.js", function() {
    	$('#hos-banner-slide').innerfade({
          type:      'sequence',
          speed:    1000,
          timeout:  6000                    
         });    
    } ); 
            
	}
	
	
	
	if ( $("body:has(div.scrollable)").length != 0 )
	{
		$.getScript("http://cdn.jquerytools.org/1.1.2/tiny/jquery.tools.min.js", function() {
			$("div.scrollable").scrollable({size:4});
		});
	}
	$.ajaxSetup({ cache: false }); 
	
	
	$("div.hos-mitarbeiter-az ul.details").hide();
	$("div.hos-mitarbeiter-az ul li h3.subs").toggle(
		function(){$(this).parent().toggleClass("open");$(this).next().slideDown()},
		function(){$(this).next().slideUp();$(this).parent().toggleClass("open")}
		);
	
});

