// JavaScript Document
// Copyright (c) by Felix Rupp. All rights reserved.
// No copy, reproduction or use without written permission of Felix Rupp.
// For contact see: http://www.felixrupp.com/


function resetColors() {	
	$(":input").removeClass("error");
}


$(document).ready(function(){
	
	// Accordion Effekte
	$(".standardAccordion").accordion({clearStyle: true, collapsible: true, autoHeight: false, active: false, header: 'h3'});
	
	
	
	// Textgroessen
	$("#smallFontSize").click(function(event){
		event.preventDefault();
		$(document.body).css({'font-size':0.7+'em'});
	});
	
	$("#normalFontSize").click(function(event){
		event.preventDefault();
		$(document.body).css({'font-size':0.8+'em'});
	});
	
	$("#bigFontSize").click(function(event){
		event.preventDefault();
		$(document.body).css({'font-size':1+'em'});
	});
	
	
	
	// Kontaktformular
	$('#kontaktFormular').submit(function(){
		action = $(this).attr('action');
		
		$('#submitKontakt').attr('disabled','disabled');

		$("input,textarea").removeClass("error");

		$.post(action,$("#kontaktFormular").serialize(),function(data){
			if(data=='OK') {
				$('#kontaktFormular').slideUp(600,function(){
					$(".success").fadeIn(600)
				});
			} else if(data=='Error1') {
				$('input[name=absenderName]').animate({opacity:"0"},200).addClass("error").animate({opacity:"1"},200).animate({opacity:"0"},200).animate({opacity:"1"},200);
			} else if(data=='Error2') {
				$('input[name=absenderEmail]').animate({opacity:"0"},200).addClass("error").animate({opacity:"1"},200).animate({opacity:"0"},200).animate({opacity:"1"},200);
			} else if(data=='Error4') {
				$('textarea[name=absenderNachricht]').animate({opacity:"0"},200).addClass("error").animate({opacity:"1"},200).animate({opacity:"0"},200).animate({opacity:"1"},200);
			}
			$('#submitKontakt').attr('disabled','');
		});

	return false;
	});	
	
	
});