	log('processing job seeker form');
	
	function setJobSeekersDefaults() {
		$("input[name=name]").DefaultValue("Your Full Name");
		$("input[name=email]").DefaultValue("your_email@domain.com");
		$("input[name=phone]").DefaultValue("Phone: ###-###-####");
		$("input[name=fax]").DefaultValue("Fax: ###-###-####");
		$("input[name=address]").DefaultValue("Your Address");
		$("input[name=city]").DefaultValue("City");
		$("input[name=state]").DefaultValue("St");
		$("input[name=zip]").DefaultValue("Zip: #####");
		$("input[name=position]").DefaultValue("Name Position");
	}
	
	$(document).ready( function() {
			
		//setJobSeekersDefaults();

		$(document).bind('THICKBOX_SHOW', function(event) {
			
			log("THICKBOX_SHOW");
			
			/**
			 * Wire up our form for some ajax goodness
			 * 
			 * This code
			 */
			$('#TB_ajaxContent').children('form')
				.css('display', 'block')
				.submit(function(event) {
			
					log(this);
			
					log($(this));
			
					// Do the form submit

					// We need to save the form data to the server
					// So we first serialize it
			
					var str = $(this).serialize();
					str += '&submit=submit';
			
					var array = $(this).serializeArray();
			
					log("SERIALIZED FORM: '" + str + '"');
			
					log("SERIALIZED ARRAY:");
					log(array);

					$.post('?ajax=TRUE&url=site_library/ajax/accept_form.php', str, function(data, textStatus) {
				
						log("form submitted");
				
						if(data.success != true) {
					
							$('input', '#TB_ajaxContent').removeClass('error');
							$('div', '#TB_ajaxContent').removeClass('error');
					
							for (var i in data.error) {
								log('processing error ' + i);
								var target = $('input[name=' + i + ']');
								
								if(target.length == 0) {
									target = $('label[for=' + i + ']').parent();
								}
								
								log(target);
						
								// If the target is a radio button or check box then add the error
								// to the item's parent div.
						
								if(target.length > 0) {
									if( (target.attr('type') == 'radio') || (target.attr('type') == 'checkbox')) {
										target.parent().addClass('error');
									}
									else {
										target.addClass('error');
									}
								}
							}
							
							//setJobSeekersDefaults();
					
						}
						else {
							tb_remove();
						}
				
					}, "json");

					// Prevent this form from doing the normal action
			
					event.stopPropagation();
					return false;
				});
		
			$(function() {
				$("#resume").makeAsyncUploader({
					upload_url: "/site_library/ajax/upload.php", // Important! This isn't a directory, it's a HANDLER such as an ASP.NET MVC action method, or a PHP file, or a Classic ASP file, or an ASP.NET .ASHX handler. The handler should save the file to disk (or database).
					flash_url: '/delicious_cms/library/js/jquery.plugins/jquery-asyncUpload-0.1/swfupload.swf',
					button_image_url: '/delicious_cms/library/js/jquery.plugins/jquery-asyncUpload-0.1/blankButton.png'
				});
				$("#jobdescription").makeAsyncUploader({
					upload_url: "/site_library/ajax/upload.php", // Important! This isn't a directory, it's a HANDLER such as an ASP.NET MVC action method, or a PHP file, or a Classic ASP file, or an ASP.NET .ASHX handler. The handler should save the file to disk (or database).
					flash_url: '/delicious_cms/library/js/jquery.plugins/jquery-asyncUpload-0.1/swfupload.swf',
					button_image_url: '/delicious_cms/library/js/jquery.plugins/jquery-asyncUpload-0.1/blankButton.png'
				});
			});			
		});
	});
	
