var d = document;
var clientFlash = 0;

var isIE = (navigator.appVersion.indexOf('MSIE') != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf('Windows') != -1) ? true : false;

if (isIE && isWin) {
	var vb = '';
	vb += '<scr' + 'ipt language="vbscript" type="text/vbscript"> \n';
	vb += 'dim is_flash, i \n';
	vb += 'is_flash = false \n';
	vb += 'i = 11 \n';
	vb += 'do while i >= 4 \n';
	vb += 'on error resume next \n';
	vb += 'is_flash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) \n';
	vb += 'if is_flash = true then exit do \n';
	vb += 'i = i - 1 \n';
	vb += 'loop \n';
	vb += 'clientFlash = i \n';
	vb += '<\/scr' + 'ipt> \n';
	d.write(vb);
}

if (navigator.plugins) {
	if (navigator.plugins['Shockwave Flash 2.0'] || navigator.plugins['Shockwave Flash']) {
		var isVersion2 = navigator.plugins['Shockwave Flash 2.0'] ? ' 2.0' : '';
		var flashDescription = navigator.plugins['Shockwave Flash' + isVersion2].description;
		clientFlash = parseInt(flashDescription.charAt(flashDescription.indexOf('.') - 1));
	}
}

function checkFlash(mV) {
	this.flash = false;
	if (clientFlash >= mV) this.flash = true;
}

function flashObj() {
	this.startHTML = '';
	this.endHTML = '';
	this.minVer = 6;
	this.alt = '';
	this.flashFile = '';
	this.ID = 'flashObj';
	this.width = '520';
	this.height = '30';
	this.menu = 'false';
	this.flashvars = '';
	this.quality = '';
	this.scriptaccess = 'always';
	this.scale = '';
	this.bgcolor = '';
	this.wmode = 'opaque';
	this.deviceFont = '';
	this.LiveConnect = '';
	this.cabVer = '#version=6,0,0,0';
	this.render = writeOutput;
	this.create = create;
}

function create() {
	document.write(this.render());
}

function writeOutput() {
	var src = '';
	var cF = new checkFlash(this.minVer);
	if (cF.flash) {
		src += this.startHTML;
		src += '<object id="' + this.ID + '" width="' + this.width + '" height="' + this.height + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab' + this.cabVer + '">';
		src += '<param name="movie" value="' + this.flashFile + '" />';
		src += '<param name="wmode" value="' + this.wmode + '" />';
		src += '<param name="allowScriptAccess" value="' + this.scriptaccess + '" />';
		if (this.menu != '') src += '<param name="menu" value="' + this.menu + '" />';
		if (this.flashvars != '') src += '<param name="flashvars" value="' + this.flashvars + '" />';
		if (this.quality != '') src += '<param name="quality" value="' + this.quality + '" />';
		if (this.scale != '') src += '<param name="scale" value="' + this.scale + '" />';
		if (this.bgcolor != '') src += '<param name="bgcolor" value="' + this.bgcolor + '" />';
		if (this.deviceFont != '') src += '<param name="devicefont" value="' + this.devicefont + '" />';
		src += '<embed src="' + this.flashFile + '" id="' + this.ID + '" name="' + this.ID + '" width="' + this.width + '" height="' + this.height + '" ';
		src += 'wmode="' + this.wmode + '" ';
		src += 'allowScriptAccess="' + this.scriptaccess + '" ';
		if (this.menu != '') src += 'menu="' + this.menu + '" ';
		if (this.flashvars != '') src += 'flashvars="' + this.flashvars + '" ';
		if (this.quality != '') src += 'quality="' + this.quality + '" ';
		if (this.scale != '') src += 'scale="' + this.scale + '" ';
		if (this.bgcolor != '') src += 'bgcolor="' + this.bgcolor + '" ';
		if (this.deviceFont != '') src += 'devicefont="' + this.deviceFont + '" ';
		if (this.LiveConnect != '') src += 'swliveconnect="' + this.LiveConnect + '" ';
		src += 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
		src += '</object>';
		src += this.endHTML;
	} 
	else {
		if (this.alt) src = this.startHTML + this.alt + this.endHTML;
	}
	if (isIE && isWin) {
		//src += '<scri' + 'pt type="text/javascript" src="http://www.sacbee.com/static/js/ads/fix_eolas.js" defer="defer"></scr' + 'ipt>';
	}
	return src;
}
