// acrobat_check
var passesAcrobatReaderRequirements = false;
var MIN_ACROBAT_VERSION = 5;

document.writeln("<OBJECT id=pdfObj height=0 width=0 classid=clsid:CA8A9780-280D-11CF-A24D-444553540000></OBJECT>");

var acrobatVersion = 0;
function errorHandler(message, url, line) 
{
	displayAcrobatMessage();
	return true;
}

function setAcrobatVersion() {
	var version;
	version = 0;
		
	//check that Acrobat IE plugin is present
	if (navigator.appName.indexOf("Microsoft Internet Explorer") > -1) { 
		//GetVersions() gets lists all plug-ins and their versions
		window.onerror = errorHandler
		version = pdfObj.GetVersions();
		window.onerror = null;
		
		var arrResults = version.match(/\s*\=\s*(\d+)\.(\d+)\.(\d+)/im);
		if (arrResults != null){
			version = parseFloat(arrResults[1] + "." + arrResults[2]);
		}
		else{
			version = 0.0;
		}
	}
	else {
		//check that Acrobat Netscape plugin is present
		if (navigator.plugins && navigator.plugins["Adobe Acrobat"].description != "") {
			version = navigator.plugins["Adobe Acrobat"].description; 
			var tmp = "Adobe Acrobat Plug-In Version ";
			var tmp2 = " for Netscape";
			var pos = tmp.length;
			var pos2 = version.indexOf(tmp2); 
			version = parseFloat(version.substring(pos, pos2)); 
		}

	}
	acrobatVersion = version;
}

setAcrobatVersion();

if (acrobatVersion >= MIN_ACROBAT_VERSION)
{
	passesAcrobatReaderRequirements = true;
}
else
{
	displayAcrobatMessage();
}

function displayAcrobatMessage(){
	document.writeln("<HR>Adobe Acrobat Reader&reg; " + MIN_ACROBAT_VERSION + ".0 is not installed on your system. This courseware makes extensive use of PDF files to supply supplemental information to the learner. These files can be viewed through the browser with the Acrobat Reader plugin. Use the following link to download the newest version of <a href=\"http://www.adobe.com/products/acrobat/readstep.html\">Adobe Acrobat Reader</a>.");
}