$(document).ready(function() {
	$('#generalSubmit').click(function(){
		var validated = true;
		$('#applicationForm input.required').each(function() {
			if($(this).val() == "") {
				validated = false;
			}
		});
		
		if(!validated) {
			alert('Niet alle verplichte velden zijn ingevuld. Kunt u deze alstublieft alsnog invullen?\n\nNot all required field are filled in. Please fill in all required fields.');
		} else {
			return true;
		}
		return false;
	});
	
	$('input.print').click(function(){
    	$('#job_application_result_outer').print({});
    	return false;
    });
});

(function(){
	jQuery.fn.print = function(options){
		//var o = $.extend({css:"",},options);
		var html = 	"<HTML>\n<HEAD>\n<style type='text/css'>\n"+
					options.css+"</style>"+
					$("head").html()+"\n</HEAD>\n<BODY>\n";
		this.each(function(i,e){
			html += "<DIV class=\"print_area\">\n"+
					$(e).html()+"</DIV>\n";
		});
			html += "</BODY>\n</HTML>";
		var printWP = window.open("","printWebPart", 'width=800,height=600,scrollbars=yes' );
		printWP.document.open();
		printWP.document.write(html);
		printWP.document.close();
		printWP.print();
		return false;
	};
})();