// JavaScript Document
/*
	disableNewsStoryButtons
	-this disables all the news story buttons.
*/
function disablePDFButtons(xform){

	if(xform.save_button)
		xform.save_button.disabled=true; //DISABLE THE SUBMIT BUTTON
	
	if(xform.save_close_button)
		xform.save_close_button.disabled=true; //DISABLE THE SUBMIT BUTTON
}

/*
	saveNewsStoryForm
	-this attempts to save and redirect to story edit page
*/
function savePDFForm(next_value){

	var bErrors = false;
	var bErrorStr = '';
	
	
	
	var xform = getObject('edit_form');

	//alert( xform );

	//error checking
	if(xform.pgal_title){
		if(xform.pgal_title.value==''){
			bErrors = true;
			bErrorStr = 'The Title field is required.';
			xform.pgal_title.className = 'jserror';
		}
	}

	//this value tells the form where to redirect after saving
	xform.nm_next.value = next_value;
	
	//TODO: do some error checking
	
	//submit xform POST
	if(bErrors){
		alert(bErrorStr);
	}else{
		//disable all the news story form buttons
		disableNewsStoryButtons(xform);
	
		//alert('submit');
		xform.submit();
	}

}

function deletePDF(pid){
	url = "?m=pdfs&nm=delete&pid="+pid;
	message = "Are you sure you want to delete this pdf file?";
	confirmAction(url,message);
}