// Adobe Acrobat Detection  v1.0
// http://www.dithered.com/javascript/acrobat_detect/index.html
// code by Chris Nott (chris@NOSPAMdithered.com - remove NOSPAM)
 
var acrobatVersion = 'NO';
var acrobatVersion_DONTKNOW = 'NO';
function getAcrobatVersion() {
	var agent = navigator.userAgent.toLowerCase();
	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Acrobat plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
	   for (i=0; i < navigator.plugins.length; i++ ) {
         var plugin = navigator.plugins[i];
		 if (plugin.name.indexOf("Adobe Acrobat") > -1) {
			acrobatVersion = 'YES';
			break;
         }else if(plugin.name.indexOf("Adobe Acrobat") < 0) {
			acrobatVersion = acrobatVersion_DONTKNOW;
		 }
	   }
	}

	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	
		for (x=2; x<10; x++) {
			try {
				oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
				if (oAcro) {
					acrobatVersion = 'YES';
				}
			  } catch(e) {}
		}
		// Just for Acrobat 7
		try{
		  oAcro4=new ActiveXObject('AcroPDF.PDF');
		  if (oAcro4){
			acrobatVersion = 'YES';
		  }
		} catch(e) {}
		// end new code
	}
	// Can't detect in all other cases
	else {
		acrobatVersion = acrobatVersion_DONTKNOW;
	}

	return acrobatVersion;
}
