// checks for non-HTML file types, and if so, generates link to reader & file size
// last updated 2007-01-09
// Peter Mosinskis

function convert_fs(nm,fs) {
	
	var filenamematch = 0;
	var filetype = "";
	var filetypeURL = "";
	
	if (nm.search(/\.pdf/i) != -1) {
		filenamematch = 1;
		filetype = "PDF";
		filetypeURL = "http://www.adobe.com/products/acrobat/readstep2.html";
	}
	if (nm.search(/\.doc/i) != -1) {
		filenamematch = 1;
		filetype = "MS Word";
		filetypeURL = "http://www.microsoft.com/downloads/details.aspx?familyid=95E24C87-8732-48D5-8689-AB826E7B8FDF&displaylang=en";
	}
	if (nm.search(/\.xls/i) != -1) {
		filenamematch = 1;
		filetype = "MS Excel";
		filetypeURL = "http://www.microsoft.com/downloads/details.aspx?FamilyID=c8378bf4-996c-4569-b547-75edbd03aaf0&DisplayLang=en";
	}
	if (nm.search(/\.ppt/i) != -1) {
		filenamematch = 1;
		filetype = "MS PowerPoint";
		filetypeURL = "http://www.microsoft.com/downloads/details.aspx?FamilyId=428D5727-43AB-4F24-90B7-A94784AF71A4&displaylang=en";
	}
	
	
	if (filenamematch == 1 ){
		// do this if match to .pdf file extension found
		var filesize = fs / 1024; // file size in KB
		//document.write (" test: " + filesize + "KB)");
		filesize =  Math.round(filesize * 10) / 10; // round to 1 decimal place
		if (filesize > 1000) {
				filesize = filesize / 1024; // file size in MB
				filesize =  Math.round(filesize * 10) / 10; // round to 1 decimal place
				var UOM = "MB";
		} else {
				var UOM = "KB";
		}
		// write results
				document.write ("(<a href=\"" + filetypeURL + "\">" + filetype + "</a>, " + filesize + UOM + ")");
	} else {
		// no match found
		//document.write ("NO MATCH FOUND.");
	}
return;	
}

//  End -->