var menudelay;
var _self;
jQuery(document).ready(function(){
	
	
	// Hover Arrow Reg Tab
	
	$("#ct-reg-tab ul li a").hover(function() {
		$(this).next("img").show();
	},function(){
		if(!$(this).hasClass('active'))$(this).next("img").hide();
	});


	$('#app-ct-reg-tab ul li a').hover(function() {
		$(this).next("img").show();
	},function(){
		if(!$(this).hasClass('active'))$(this).next("img").hide();
		
	});
	

	// hover Appothekenfinder
	$('#reg-tab li a').hover(function() {
		
		window.clearInterval(menudelay);
		$(this).next("ul").show();
		
	},function(){
		
		_self = $(this);

		menudelay = setTimeout(function(){

			$(_self).next("ul").hide();
		}, 3000);
			
	});
	
	
	
	$('#reg-tab ul').hover(function() {
		
		window.clearInterval(menudelay);
		
	},function(){
		
		_self = $(this)
			
		menudelay = setTimeout(function(){

			$(_self).hide();
		}, 3000);
		
	});
		
	// Reg Tabs
	$('.app-ct-text').hide();
	$('.app-ct-text:first').show();
	
	if(window.location.href.indexOf('?tab=') == -1)$('#app-ct-reg-tab li a:first').addClass('active');
	
	$('#app-ct-reg-tab li a').click(function(){
		try{
			$('.formError').remove();
			
			$('#app-ct-reg-tab ul li a').removeClass('active');
			$(this).addClass('active')
			$('#app-ct-reg-tab ul li a').next("img").hide();
			$(this).next("img").show();
			$('.app-ct-text').addClass('active');
			var currentTab = $(this).attr('href');
			$('.app-ct-text').hide();
			$(currentTab).show();
			return false;
		}catch(err){}
		
	});
	
	// Link Arrow
	$('.flexslider-inner p a').append('<img src="/static/img/slider_link_arr.png" border="0" alt="" width="18" height="8" />');
	
	
	//Accordion
	$(function() {
		$('.accordion .head').click(function() {
			$(this).next().toggle('slow');
			return false;
		}).next().hide();
	});
	
	// Hover  Content Nav
	$(function() {
		$("#home-content-nav ul ul").hover(function() {
			$(this).parent('li').children('a').css('background-color', '#99cc00');
		},function(){
			$(this).parent('li').children('a').css('background-color', '#223575');
		});
	});
	
	$("#fieldset-form dl").append("<dt id='pflichtfeld-label'>&nbsp;</dt>");
	$("#fieldset-form dl").append("<dd id='pflichtfeld-element'>*Pflichtfelder</dd>");
	
	if($.browser.msie){
		$(".sf-menu ul").css('margin-top', '0px');
	}else{
		$(".sf-menu ul").css('margin-top', '-1px');
	}
	
		
});
