$(document).ready(function() {   
	$('.btn').button();
	
	$('.datePicker').datepicker({
		dateFormat: 'yy-mm-dd'
	});
	
	$('#formResume').validate();
	$('#formJob').validate();
			
	$('#formResume').ajaxForm(function() { 
		$('#formResume').slideUp();
		$('#formStatus').show();
	});
	
	$('#formJob').ajaxForm(function() { 
		$('#formJob').slideUp();
		$('#jobStatus').show();
	});
	
	$('a.viewResume').live('click', function() {
		var title = this.title;
        var url = this.href;
        var dialog = $('<div style="display:hidden"></div>').appendTo('body');
        // load remote content
        dialog.load(
                url, 
                {},
                function (responseText, textStatus, XMLHttpRequest) {
                        dialog.dialog({
							title: title,
							//height: 520,
							width: 500,
							modal: true,
							buttons: {
								Close: function() {
									$(this).dialog('destroy');
									$(this).dialog('close');
								}
							},
							close: function() {
								$(this).dialog('destroy');
								$(this).dialog('close');
							}
						});
                }
        );
        //prevent the browser to follow the link
        return false;
	});
});
