$(function(){
	$(".photoLink").lightBox({
		fixedNavigation:false
	});
	
	$(".photoLink").click(function(){
		return false;
	});
	
	//	Save
	//pre-submit callback
	function showRequest(formData, jqForm, options){
		var errorMsg = '';
		if($("#photo_owner_name").val() == ''){
			errorMsg += "Please enter your name.<br/>";
		}
		if($("#photo_owner_email").val() == ''){
			errorMsg += "Please enter your email address.<br/>";
		}
		if($("#photo_title").val() == ''){
			errorMsg += "Please enter a title for your photo.<br/>";
		}
		if($("#photo_album_id").val() == ''){
			errorMsg += "Please choose an album.  If no album is listed, please refresh your browser.<br/>";
		}
		if($("#fileUpload").val() == ''){
			errorMsg += "Please choose a photo to upload.<br/>";
		}
		
		if(errorMsg != ''){
			$.prompt(errorMsg);
			return false;
		}
		$.blockUI({ css: { 
	        border: 'none', 
	        padding: '15px', 
	        backgroundColor: '#000', 
	        '-webkit-border-radius': '10px', 
	        '-moz-border-radius': '10px', 
	        opacity: '.5', 
	    	color: '#fff' 
	    } }); 
		return true;
	}
			
	//post-submit callback
	function showResponse(responseText, statusText){
		$.unblockUI();
		$.prompt(responseText);
		$("#frmPhoto").resetForm();
	}
	
    $("#frmPhoto").ajaxForm({beforeSubmit:showRequest,success:showResponse,url:"/resources/library/processors/proc.savePhoto.php",type:"post"});
});
