// Quicktime Detection / Redirect (cookie variant)  v1.0
// documentation: http://www.dithered.com/javascript/quicktime_cookie/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)
// requires: quicktime_detect.js (http://www.dithered.com/javascript/quicktime_detect/index.html)


var dontKnow = false;
var quicktimeVersion = 0;

// Retrieve quicktime cookie
var cookieStart = document.cookie.indexOf('quicktime');
if (cookieStart != -1) {
	var cookieEnd = document.cookie.indexOf(';', cookieStart);
	if (cookieEnd == -1) cookieEnd = document.cookie.length;
	quicktimeVersion = document.cookie.substring(cookieStart + 10, cookieEnd); 
}

// If the cookie doesn't exist...
else {
	
	// use quicktime_detect.js to return the Quicktime version
	quicktimeVersion = getQuicktimeVersion();
	
	// write the version information to a cookie
	document.cookie = 'quicktime=' + quicktimeVersion;
}

// For the situation where we can't detect, set the values of the reference variables
if (quicktimeVersion == quicktimeVersion_DONTKNOW) {
	quicktimeVersion = 0;
	dontKnow = true;
}

