

/////////////////////TABSETS///////////////

$(document).ready(function() {

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
	$defaultText = 'Ihre Ausgangsadresse';
	
	if($("#addressform-city").val() == ''){
		$("#addressform-city").val($defaultText);
		$("#addressform-city").addClass('inactive');
	}
	
	$("#addressform-city").click(function(){
		if($(this).val() == $defaultText){
			$(this).val('');
			$("#addressform-city").removeClass('inactive');
		}
		
	});
	$("#addressform-city").blur(function(){
		if($(this).val() == ''){
			$(this).val($defaultText);
			$("#addressform-city").addClass('inactive');
		}
	});
	
	
	
	// Attribute Preselect (BEGIN)
	
	$('#preselection-freieSuche').click(function() {
		preselectReset();
		$("#att1").hide();
		$("#att2").hide();
		$("#att3").hide();
		$("#att4").hide();
		$("#att5").hide();
		$("#att6").hide();
		$("#att7").hide();
		$("#att8").hide();
		$("#att9").hide();
		$("#att10").hide();
		$("#att11").hide();
		$("#att12").hide();
		$("#att13").hide();
		$("#att14").hide();
		$("#att15").hide();
		$("#att16").hide();
		$("#att17").hide();
		$("#att18").hide();
		$("#att19").hide();
		$("#att20").hide();
		$("#att21").hide();	
		
		$("#att1").fadeIn('fast');
		$("#att2").fadeIn('fast');
		$("#att3").fadeIn('fast');
		$("#att4").fadeIn('fast');
		$("#att5").fadeIn('fast');
		$("#att6").fadeIn('fast');
		$("#att7").fadeIn('fast');
		$("#att8").fadeIn('fast');
		$("#att9").fadeIn('fast');
		$("#att10").fadeIn('fast');
		$("#att11").fadeIn('fast');
		$("#att12").fadeIn('fast');
		$("#att13").fadeIn('fast');
		$("#att14").fadeIn('fast');
		$("#att15").fadeIn('fast');
		$("#att16").fadeIn('fast');
		$("#att17").fadeIn('fast');
		$("#att18").fadeIn('fast');
		$("#att19").fadeIn('fast');
		$("#att20").fadeIn('fast');
		$("#att21").fadeIn('fast');	
	});	

	$('#preselection-reitlehrerFinden').click(function() {
		preselectReset();
		$("#att7").attr('checked', true); // Reitunterricht
		$("#att7").hide();
		$("#att7").fadeIn('fast');
	});
	
	$('#preselection-reitanlageNutzen').click(function() {
		preselectReset();
		$("#att1").attr('checked', true); // Reithalle
		$("#att2").attr('checked', true); // Reitplatz
		$("#att1").hide();
		$("#att1").fadeIn('fast');
		$("#att2").hide();
		$("#att2").fadeIn('fast');
	});
	
	$('#preselection-pferdeUnterstellen').click(function() {
		preselectReset();
		$("#att14").attr('checked', true); // Pferde unterstellen
		$("#att14").hide();
		$("#att14").fadeIn('fast');		
	});
	
	$('#preselection-pferdetrainer').click(function() {
		preselectReset();
		$("#att8").attr('checked', true);	// Beritt
		$("#att8").hide();
		$("#att8").fadeIn('fast');		
	});
	
	$('#preselection-reiturlaub').click(function() {
		preselectReset();
		$("#att10").attr('checked', true); // Urlaub
		$("#att10").hide();
		$("#att10").fadeIn('fast');		
	});
	
	$('#preselection-pferdezucht').click(function() {		
		preselectReset();
		$("#att18").attr('checked', true); // Stuten
		$("#att19").attr('checked', true); // Hengste
		$("#att20").attr('checked', true); // Fohlen
		$("#att21").attr('checked', true); // Verkaufspferde			
		$("#att18").hide();
		$("#att19").hide();
		$("#att20").hide();
		$("#att21").hide();	
		$("#att18").fadeIn('fast');
		$("#att19").fadeIn('fast');
		$("#att20").fadeIn('fast');
		$("#att21").fadeIn('fast');	
	});
		
	//Attribute Preselect (END)	
	
		
	
});

function selectTab(tabnumber){
	$("ul.tabs li").removeClass("active"); //Remove any "active" class
	$("ul.tabs li#"+tabnumber).addClass("active"); //Add "active" class to selected tab
	$(".tab_content").hide(); //Hide all tab content
	var activeTab = $("ul.tabs li#"+tabnumber).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
	$(activeTab).fadeIn(); //Fade in the active content

	//document.location.hash='#tab' + tabnumber;
}


//Attribute Preselect Reset
function preselectReset() {
	$("#att1").attr('checked', false);
	$("#att2").attr('checked', false);
	$("#att3").attr('checked', false);
	$("#att4").attr('checked', false);
	$("#att5").attr('checked', false);
	$("#att6").attr('checked', false);
	$("#att7").attr('checked', false);
	$("#att8").attr('checked', false);
	$("#att9").attr('checked', false);
	$("#att10").attr('checked', false);
	$("#att11").attr('checked', false);
	$("#att12").attr('checked', false);
	$("#att13").attr('checked', false);
	$("#att14").attr('checked', false);
	$("#att15").attr('checked', false);
	$("#att16").attr('checked', false);
	$("#att17").attr('checked', false);
	$("#att18").attr('checked', false);
	$("#att19").attr('checked', false);
	$("#att20").attr('checked', false);
	$("#att21").attr('checked', false);	
}


