// Acrobat Detection / Redirect (cookie variant)  v1.0
// documentation: http://www.dithered.com/javascript/acrobat_cookie/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)
// requires: acrobat_detect.js (http://www.dithered.com/javascript/acrobat_detect/index.html)


var dontKnowAcrobatVersion = false;
var acrobatVersion = 0;

// Retrieve acrobat cookie
var cookieStart = document.cookie.indexOf('acrobat');
if (cookieStart != -1) {
	var cookieEnd = document.cookie.indexOf(';', cookieStart);
	if (cookieEnd == -1) cookieEnd = document.cookie.length;
	acrobatVersion = document.cookie.substring(cookieStart + 8, cookieEnd); 
}

// If the cookie doesn't exist...
else {
	
	// use acrobat_detect.js to return the Acrobat version
	acrobatVersion = getAcrobatVersion();
	
	// write the version information to a cookie
	document.cookie = 'acrobat=' + acrobatVersion;
}

// For the situation where we can't detect, set the values of the reference variables
if (acrobatVersion == acrobatVersion_DONTKNOW) {
	acrobatVersion = 0;
	dontKnowAcrobatVersion = true;
}

