/**
 * JavaScript Functions
 *
 * @package WordPress
 * @subpackage boa_detention
 * @since boa_detention 1.0
 * @author Christian Wölk | swe media
 */
$(document).ready(function() {
	$('a.lightbox-blank').lightBox();
	/**
	 * This function handles the mailform
	 */
	$('#submit').click(function() {
		//$('#submit').attr('disabled', 'disabled');

		var name = $('#name').val();
		var mail = $('#mail').val();
		var town = $('#town').val();
		var country = $('#country').val();
		var song = $('#song').val();
		var message = $('#message').val();
		
		var response = $.ajax({
			type: "POST",
			url: "wp-content/themes/boa_detention/mail.php",
			data: "name=" + name + "&mail=" + mail + "&town=" + town + "&country=" + country + "&song=" + song + "&message=" + message + "&send=true",
			async: false
		}).responseText;

		if(name=="" || mail=="" || town=="" || country=="" || song=="") {
			$('#mailform').html(response);
		} else {
			$('#post-14').html(response);
		}
		
		$.ajax({
			type: "GET",
			url: "wp-content/themes/boa_detention/functions.js",
			dataType: "script"
		});
	});
});
