
var theVString = '0';
var theVersion = '0.0';
var theVersionSplit = theVersion.split(".");
var theRelease = '0';
var tester, replacer;

var appName = "unknown";
var userAgent = "unknown";
var flashVersion = 0;

var theDate = new Date();
var theCacheString =  theDate.getMinutes() + "." + theDate.getSeconds() + "." + theDate.getMilliseconds();

if (document.images) {
	tester = new Image();
//	tester.src = "http://www.eluxury.com/asset_server/global/p.gif?" + theCacheString;
	replacer = new Image();
}

function detectFlash() {
	
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

	if (navigator.plugins) {
		if (navigator.mimeTypes && navigator.mimeTypes['application/x-shockwave-flash'] && navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin && (navigator.mimeTypes['application/x-shockwave-flash'].suffixes.indexOf('swf') != - 1)) {
			theVString = plugin.description.substring(plugin.description.indexOf(".") - 1);
			theVersion = theVString.slice(0,3);
			theVersionSplit = theVersion.split(".");
			theRelease = plugin.description.substring(plugin.description.indexOf("r") + 1);
			writeImageTag();

		} else if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin && navigator.plugins && navigator.plugins["Shockwave Flash"]) {
			theVString = '3';
			theVersion = '0.0'
			theVersionSplit = theVersion.split(".");
			theRelease = '0';
			writeImageTag();

		} else if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
			theVersionSplit[0] = detectWinFlash();
			writeImageTag();

		} else {
			theVString = '0';
			theVersion = '0.0'
			theVersionSplit = theVersion.split(".");
			theRelease = '0';
			writeImageTag();
		}
				
	} else {
		theVString = '0';
		theVersion = '0.0'
		theVersionSplit = theVersion.split(".");
		theRelease = '0';
		writeImageTag();

	}
}

function writeImageTag() {
	appName = navigator.appName;
	userAgent = navigator.userAgent;
	flashVersion = theVersionSplit[0] + '.' + theVersionSplit[1] + "." + theRelease;
	
	if (theVersionSplit[0] > 6) {
		write_cookie('flashCookie', 6, 30);
	} else {
		write_cookie('flashCookie', theVersionSplit[0], 30);
	}

	// replacer.src = "http://www.eluxury.com/cgi-bin/plugin_pixel.pl?" + "&flash_version=" + flashVersion + "&theCache=" + theCacheString;
}

detectFlash();
	


