$(document).ready(function() {
	prepareForms();
	$('#einm').click(function() {
		$('#einmalig').show();
		$('.raten').hide();
	});
	$('#wkz').click(function() {
		$('#einmalig').hide();
		$('.raten').show();
	});
	$('.submit').hover(function() {
		$(this).addClass('hover');
	},function() {
		$(this).removeClass('hover');
	});
	wh = $(window).height();
	ww = $(window).width();
	if(wh > 768 && ww > 1024) {
		$('#wrapper').css('position', 'absolute');
		$('#wrapper').css('top', '50%');
		$('#wrapper').css('left', '50%');
		$('#wrapper').css('margin', '-340px auto auto -480px');	
	}
	$('#nav ul li:last').addClass("last");
});
function resetFields(whichform) {

	var url = window.location.href;

	if(url.indexOf("do=send")<0) {

		for (var i=0; i<whichform.elements.length; i++) {
			var element = whichform.elements[i];

			if(element.type == "submit") continue;
			if(element.type == "radio") continue;
			if(element.type == "checkbox") continue;
			if(!element.defaultValue) continue;

			element.onfocus = function() {
				if(this.value == this.defaultValue) this.value = "";
			}
			element.onblur = function() {
				if(this.value == "") this.value = this.defaultValue;
			}
		}
	}
}
function prepareForms() {
	for(var i=0; i<document.forms.length; i++) {
		resetFields(document.forms[i])
	}
}

