function refresh_captcha_ajax()
{
	jQuery.ajax({		
		url: site_url+'ajax_function/refresh_captcha/',
		type: "POST",
		timeout: 5000,
		error: function(){ console.log("25:Fehler"); },
		success: function(ret){ 
				$('#captchaImage').html(ret);	
			}
	});		
}
$(document).ready(function() {

	/*
	jQuery.webPrejudice({
		loc: site_url+"js/prejudice/default.xml",
		target: "ie6"
		});
	*/	
  $('#search_request_schwerp').focus(
  	function () {
  		$('#search_options_schwerp').css( 'display', 'block' );
  	}

   );
   $('#search_request_service').focus(
  	function () {
  		$('#search_options_service').css( 'display', 'block' );
  	}

   );
   /*
   $('#search_request').blur(
  	function () {  		
		  if (!$("#search_options").mouseover())
  		$('#search_options').css( 'display', 'none' );
  	}

   );
   */
	$('#search_options_schwerp_close_button').click(
		function () {
			$('#search_options_schwerp').css( 'display', 'none' );
		}
	);
	$("input:radio[name=schwerp]").change( function () 
			{
				$('#search_form_schwerp').attr( 'action' ,	site_url+'zahnarztsuche/nach/'+ this.value );				
			});
			
	$('#search_options_service_close_button').click(
		function () {
			$('#search_options_service').css( 'display', 'none' );
		}
	);
	$("input:radio[name=service]").change( function () 
			{
				$('#search_form_service').attr( 'action' ,	site_url+'keydexplus/nach/'+ this.value );				
			});
	
			

	
	$("#search_form_schwerp").validationEngine({});
	$("#search_form_service").validationEngine({});


	
});
function fast_post()
{
	topx = parseInt(((document.all)?document.body.scrollTop:window.pageYOffset))+20;
	if ($('#fast_post_popup_window').length!=0) 
	{
		$('#fast_post_popup_window').css('margin-top', topx+20+'px');
		$('#fast_post_popup_window').css('display','block');
		
		return;	
	} 
	jQuery.ajax({
		// data: 'user_id='+user_id,
		url: site_url+controller.forum+'/load_fast_post_popup/',
		type: "POST",
		timeout: 5000,
		error: function(){ console.log("25:Fehler"); },
		success: function(ret){
			
			$(document.body).append('<div id="fast_post_popup_window" style="margin-top:'+topx+'px">'+ret+'</div>'); 
			
			}
	});		
	
}
function profil_upgrade( user_id)
{
	if ( !$('#agb_gelesen').attr('checked'))
	{
		alert('Sie müssen AGB zustimmen!!!');
	
		return;	
	}
	
	jQuery.ajax({
		data: 'user_id='+user_id,
		url: site_url+'ajax_function/profil_uprgade/',
		type: "POST",
		timeout: 5000,
		error: function(){ console.log("25:Fehler"); },
		success: function(ret){
			$('#profil_upgrade_html').html(ret);
			}
	});		
}
function save_weblink_click( user_id )
{
	jQuery.ajax({
		data: 'user_id='+user_id,
		url: site_url+'ajax_function/save_weblink_click/',
		type: "POST",
		timeout: 5000,
		error: function(){ console.log("25:Fehler"); },
		success: function(ret){ 				
			}
	});		
}
function save_empfehlung( form_id , user_id )
{	
	//form_data = document.getElementById(form_id);
	
	var inputs = [];
	//alert(form_id);
	form = document.getElementById(form_id);
	$(':input', form).each(function(){ inputs.push(this.name + '=' + encodeURIComponent(this.value)); })
	jQuery.ajax({
		data: inputs.join('&'),
		url: form.action,
		type: "POST",
		timeout: 5000,
		error: function(){ console.log("25:Fehler"); },
		success: function(ret){ 
			//$('#divAnfrage').html(ret);
			if ( ret == 0 ) { alert ('Sicherheitscode Falsch!!!');}
			if ( ret == 1 ) { window.location.replace(site_url+'zahnarzt/id/'+user_id); 			}  
	
			}
			});			 				

	return false;
}

function search_new_action( myform )
{
	myform.action = 'zahnaztsuche/nach/'+$('input[@name="schwerp"]').attr( 'value');
	//window.location.replace('/zahnarztsuche/nach/'+document.getElementById('search_request').value );
}
function search_new_action_service( myform )
{
	myform.action = 'keydexplus/nach/'+$('input[@name="service"]').attr( 'value');
	//window.location.replace('/zahnarztsuche/nach/'+document.getElementById('search_request').value );
}
function manage_schwerpunkt( user_id , schwerp_id , action )
{
	jQuery.ajax({
		data: 'user_id='+user_id+'&schwerp_id='+schwerp_id+'&action='+action,
		url: site_url+'ajax_function/manage_schwerpunkt/',
		type: "POST",
		timeout: 5000,
		error: function(){ console.log("25:Fehler"); },
		success: function(ret){ 
				$('#user_schwerpunkte').html(ret);	
			}
	});		
}