//################################################################//
//########################## USER_COMMENT ########################//
//################################################################//
$(document).ready(function() {
	// validate signup form on keyup and submit
	var validator = $("#comment").validate({
		rules: {
			USERNAME:  "required",
			EMAIL: {
				required: true,
				email: true
			},
			COMMENT:  "required",
			CAPTCHA: {
				required: true,
				minlength: 5
			}
			
		},
		messages: {
			USERNAME: "Bitte gib einen Namen an.",
			EMAIL:  "Bitte gib eine valide Mail Adresse an.",
			COMMENT: "Pflichtfeld!",
			CAPTCHA: "Bitte gib die Zahlen ein."
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next() );
			else if ( element.is(":checkbox") )
				error.appendTo( element.parent());
			else
				error.appendTo( element.parent());
		}	
	});
});
//################################################################//
//########################## CONTACT FORM ########################//
//################################################################//
$(document).ready(function() {
	// validate signup form on keyup and submit
	var validator = $("#contact").validate({
		rules: {
			THE_TITLE:  "required",
			NAME:  "required",
			FIRSTNAME:  "required",
			STREET:  "required",
			PLZ: {
				required: true,
				minlength: 5,
				maxlength: 5
			},
			CITY:  "required",
			COUNTRY:  "required",
			PHONE:  "required",
			FAX:  "required",
			EMAIL: {
				required: true,
				email: true
			},
			HOMEPAGE: {
				required: true,
				url: true
			},
			MESSAGE:  "required",
			CAPTCHA: {
				required: true,
				minlength: 5
			}
			
		},
		messages: {
			THE_TITLE: "&nbsp;",
			NAME: "Pflichtfeld!",
			FIRSTNAME: "Pflichtfeld!",
			STREET: "Pflichtfeld!",
			PLZ: "Pflichtfeld!",
			CITY: "Pflichtfeld!",
			COUNTRY: "Pflichtfeld!",
			PHONE: "Pflichtfeld!",
			FAX: "Pflichtfeld!",
			EMAIL: "Pflichtfeld!",
			HOMEPAGE: "Pflichtfeld!",
			MESSAGE: "Pflichtfeld!",
			CAPTCHA: "Pflichtfeld!"
			
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next() );
			else if ( element.is(":checkbox") )
				error.appendTo( element.parent());
			else
				error.appendTo( element.parent());
		}
	});
});


//################################################################//
//############################ BOOK ENTRY ########################//
//################################################################//	
$(document).ready(function() {
// validate signup form on keyup and submit
	var validator = $("#book").validate({
		rules: {
			HEADLINE:  "required",
			USERNAME:  "required",
			HOMEPAGE:  "required",
			EMAIL: {
				required: true,
				email: true
			},
			MESSAGE:  "required",
			CAPTCHA: {
				required: true,
				minlength: 5
			}
			
		},
		messages: {
			HEADLINE: "Bitte gib ein Thema an",
			USERNAME:  "Bitte gib einen Namen an",
			HOMEPAGE:  "Bitte gib eine Homepage an",
			EMAIL:  "Bitte gib Deine E-Mail an",
			MESSAGE:  "Bitte schreibe einen Kommentar",
			CAPTCHA: "Bitte gib den Sicherheitscode ein."
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next() );
			else if ( element.is(":checkbox") )
				error.appendTo( element.parent());
			else
				error.appendTo( element.parent());
		}
	});
});

