﻿function alertMsg(message,container){
	alertDebug('Start alertMsg('+message+','+container+')');
	var errorLbl=container.GetObject("ErrorLbl");
	errorLbl.innerText=message;
	alertDebug('End alertMsg('+message+','+container+')');
}

function OperationDone(type, data, evt){
	//Refreshes the page to show the new entries
	//Calles asynchronyosly by SaveFileUpload
	alertDebug('Start OperationDone('+type+','+data+','+evt+')');
	HideDialog();
	try{
		agenda.GetObject("txtDoFileUpload").value="Upload";
	} catch(err) {}
	try{
		upload.GetObject("txtDoFileUpload").value="Upload";
	} catch(err) {}
	alert(theForm.action);
	setTimeout('theForm.submit()',1000);
	alert(theForm.action);
	theForm.submit();
	alertDebug('End OperationDone('+type+','+data+','+evt+')');
}

function SaveFileUpload(){
	alertDebug('Start SaveFileUpload()');
		if (!ValidateFileUpload())
			return;
		document.getElementById("Spinner").style.display="";
		var docTitle=(agenda.GetObject("txtDocumentName").value);
		var docFilePath=(agenda.GetObject("uplDocument").value);
		var meetingID=agenda.GetObject("txtMeetingID").value;
		var agendaPointID=agenda.GetObject("txtAgendaPointID").value;
		var isPublic=agenda.GetObject("chkIsPublic").checked;
		
		var bindArgs = {
			url: "../Common/frmAJAXResponse.aspx",
			load: OperationDone,
			error:AJAXError,
			mimetype: "text/plain",
			method:"POST",
			content: {
				ServiceID:"11",
				MeetingID:meetingID,
				AgendaPointID:agendaPointID,
				IsPublic:isPublic,
				DocTitle:docTitle,
				DocFilePath:docFilePath
			}
		};
		dojo.io.bind(bindArgs);
	alertDebug('End SaveFileUpload()');
}

function UnlockText(prefix){
	alertDebug('Start UnlockText('+prefix+')');
	var txtAPText=document.getElementById(agenda.ctrlPrefix+prefix+"_txtAPText");
	var btnSave=document.getElementById(agenda.ctrlPrefix+prefix+"_btnSave");
	var btnEdit=document.getElementById(agenda.ctrlPrefix+prefix+"_btnEdit");
	txtAPText.readOnly=false;
	txtAPText.className="text11gray"; 
//	txtAPText.style.color="black";
//	txtAPText.style.backcolor="white";
	btnSave.style.display='';
	btnEdit.style.display='none';
	alertDebug('End UnlockText('+prefix+')');
}

function LockNLoadText(prefix,agendaPointID){
	alertDebug('Start alertMsg('+prefix+','+agendaPointID+')');
	var txtAPText=document.getElementById(agenda.ctrlPrefix+prefix+"_txtAPText");
	var btnSave=document.getElementById(agenda.ctrlPrefix+prefix+"_btnSave");
	var btnEdit=document.getElementById(agenda.ctrlPrefix+prefix+"_btnEdit");
	txtAPText.readOnly=true;
	txtAPText.className="gridRow"; 
//	txtAPText.style.color="";
//	txtAPText.style.backcolor="";
	btnSave.style.display='none';
	btnEdit.style.display='';
	var bindArgs = {
		url: "../Common/frmAJAXResponse.aspx",
		error:AJAXError,
		mimetype: "text/plain",
		method:"POST",
		content: {
				ServiceID:"21",
				AgendaPointID:agendaPointID,
				AgendaPointText:txtAPText.value
			}
		};
		dojo.io.bind(bindArgs);
	alertDebug('End alertMsg('+prefix+','+agendaPointID+')');
}
