// JavaScript Document

	
function processfile(fid,u)
{
	var ajax = new sack();
	var hidetr = document.getElementById('fid' + fid);	
	ajax.requestFile = 'processfile.asp?u=' + u + '&fileid='+fid;	// Specifying which file to get/*
	whenclicked(fid)
	ajax.onLoading = function () {whenLoading(fid);};
	ajax.onLoaded = function () {whenLoaded(fid);}; 
	ajax.onInteractive = function () {whenInteractive(fid);};
	ajax.onCompletion =function () {eval(ajax.response);};
	ajax.runAJAX();	
	
}

function whenLoading(fid){
	var e = document.getElementById('replaceme' + fid); 
	e.innerHTML ='<img src="images/indicator.gif" alt="Sending Data..." align="absmiddle">';
}

function whenLoaded(fid){
	var e = document.getElementById('replaceme' + fid); 
	e.innerHTML = '<img src="images/indicator.gif" alt="Data Sent..." align="absmiddle">';
}

function whenInteractive(fid){
	var e = document.getElementById('replaceme' + fid); 
	e.innerHTML = '<img src="images/indicator.gif" alt="Getting Data..." align="absmiddle">';
}

function whenclicked(fid){
	var e = document.getElementById('replaceme' + fid); 
	var hide = document.getElementById('pfimg' + fid); 
	hide.style.display ='none'
	e.innerHTML = '<img src="images/indicator.gif" alt="Sending Data..." align="absmiddle">';
}

function getschools(sel,elid)
{
	var districtid = sel.options[sel.selectedIndex].value;
	document.getElementById(elid).options.length = 0;	// Empty city select box
	if(districtid.length>0){
		var ajax = new sack();
		ajax.requestFile = 'getschools.asp?disid='+districtid;	// Specifying which file to get
		var obj = document.getElementById('schools');
		ajax.onCompletion = function () {eval(ajax.response);};	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}


function DoDelete(action)
	{
		var agree=confirm("Are you sure you wish to continue?\This action cannot be undone");
		if (agree){
			var ajax = new sack();
			var form = document.getElementById('form');
			
			var fileidcount = form.FileId.length;
			var fileidstrarr = ""
		
			if (fileidcount == null)
			{
				if(form.FileId.checked) {
				fileidstrarr = "," + form.FileId.value
				}
			}else{
				for(var count = 0; count < fileidcount; count++){
					if(form.FileId[count].checked){
						fileidstrarr = fileidstrarr + "," + form.FileId[count].value
					}
				}
			}
			ajax.requestFile = "deletefiles.asp" ;
			ajax.setVar("action",action ); 
			ajax.setVar("fileid",fileidstrarr ); 
			ajax.onCompletion = function () {eval(ajax.response);};	// Specify function that will be executed after file has been found
			ajax.runAJAX();
		}
	}
	
	
	
function DoUnDelete(fid)	
	{
		var ajax = new sack();
		var hidetr = document.getElementById('fid' + fid);	
		ajax.requestFile = 'undeletefiles.asp?fileid='+fid;	// Specifying which file to get/*
		whenclicked(fid)
		ajax.onLoading = function () {whenLoading(fid);};
		ajax.onLoaded = function () {whenLoaded(fid);}; 
		ajax.onInteractive = function () {whenInteractive(fid);};
		ajax.onCompletion =function () {eval(ajax.response);};
		ajax.runAJAX();	
		
	}

