var isLteFx2 = function() {
	var myUa = window.navigator.userAgent;
	if (myUa.indexOf('Gecko') != -1) {
		var myUaPos = myUa.indexOf('rv:');
		var myUaEngineVersion = myUa.substring(myUaPos+3, myUa.indexOf(")"));
		var rvPartsArr = new Array;
		rvPartsArr = myUaEngineVersion.split('.');
		rvPartsArrLen = rvPartsArr.length;
		var myUaEngineVersionNew = '';
		for (var i = 1; i < rvPartsArrLen; i++) {
			myUaEngineVersionNew += rvPartsArr[i];
		}
		myUaEngineVersionNew = parseFloat(rvPartsArr[0] + '.' + myUaEngineVersionNew);
		if (myUaEngineVersionNew < 1.9) {
			return true;
		} else {
			return false;
		}
	}
};

function flashCollapsedBn(objName, place, smallBnUrl, bigBnUrl, linkUrl, smallBnWidth, smallBnHeight, bigBnWidth, bigBnHeight, hideDelay) {
	smallBnWidth = '' + smallBnWidth;
	smallBnHeight = '' + smallBnHeight;
	bigBnWidth = '' + bigBnWidth;
	bigBnHeight = '' + bigBnHeight;
	var myObj = this;
	var smallBn = document.createElement('div');
	var bigBn   = document.createElement('div');
	var hideTimeoutId;
	var hideTimeoutStarted = false;
	var unit;

	if (smallBnWidth.indexOf('%') != -1) { unit = ''; } else { unit = 'px'; }
	smallBn.style.width  = '' + smallBnWidth  + unit;
	if (smallBnHeight.indexOf('%') != -1) { unit = ''; } else { unit = 'px'; }
	smallBn.style.height = '' + smallBnHeight + unit;

	var place = document.getElementById(place);
	place.style.position  = 'relative';
	if (smallBnWidth.indexOf('%') != -1) { unit = ''; } else { unit = 'px'; }
	place.style.width  = '' + smallBnWidth  + unit;
	if (smallBnHeight.indexOf('%') != -1) { unit = ''; } else { unit = 'px'; }
	place.style.height = '' + smallBnHeight + unit;

	if (bigBnWidth.indexOf('%') != -1) { unit = ''; } else { unit = 'px'; }
	bigBn.style.width    = '' + bigBnWidth    + unit;
	if (bigBnHeight.indexOf('%') != -1) { unit = ''; } else { unit = 'px'; }
	bigBn.style.height   = '' + bigBnHeight   + unit;

	bigBn.style.position = 'absolute';
	bigBn.style.top      = '0';
	if (isLteFx2()) {
		bigBn.style.display = 'none';
	} else {
		bigBn.style.left     = '-10000px';
	}
	bigBn.style.visibility = 'hidden';

	smallBnUrlOut = '' + smallBnUrl + '?objName=' + objName;
	bigBnUrlOut   = '' + bigBnUrl   + '?objName=' + objName;

	smallBn.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + smallBnWidth + '" height="' + smallBnHeight + '" id="small' + objName + '">' + 
		'<param name="movie" value="' + smallBnUrlOut + '" \/>' +
		'<param name="loop" value="true" \/>' + 
		'<param name="quality" value="high" \/>' + 
		'<param name="bgcolor" value="#FFFFFF" \/>' + 
		'<param name="allowScriptAccess" value="always" \/>' + 
		'<embed src="' + smallBnUrlOut + '" loop="true" quality="high" bgcolor="#FFFFFF" width="' + smallBnWidth + '" height="' + smallBnHeight + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" name="small' + objName + '">' + 
		'</embed>' + 
		'</object>';

	place.appendChild(smallBn);

	bigBn.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + bigBnWidth + '" height="' + bigBnHeight + '" id="big' + objName + '">' + 
		'<param name="movie" value="' + bigBnUrlOut + '" \/>' +
		'<param name="loop" value="true" \/>' + 
		'<param name="quality" value="high" \/>' + 
		'<param name="bgcolor" value="#FFFFFF" \/>' + 
		'<param name="allowScriptAccess" value="always" \/>' + 
		'<embed src="' + bigBnUrlOut + '" loop="true" quality="high" bgcolor="#FFFFFF" width="' + bigBnWidth + '" height="' + bigBnHeight + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" name="big' + objName + '">' + 
		'</embed>' + 
		'</object>';

	place.appendChild(bigBn);
	this.showBigBn = function() {
		// bigBn.style.display = 'block';
		if (isLteFx2()) {
			bigBn.style.display = 'block';
		} else {
			bigBn.style.left = '0';
		}
		bigBn.style.visibility = 'visible';
		smallBn.style.display = 'none';
		smallBn.style.visibility = 'hidden';
	};
	this.hideBigBn = function() {
		if (isLteFx2()) {
			bigBn.style.display = 'none';
		} else {
			bigBn.style.left     = '-10000px';
		}
		bigBn.style.visibility = 'hidden';
		smallBn.style.display = 'block';
		smallBn.style.visibility = 'visible';
	};
	this.hideBigBnWithDelay = function() {
		hideTimeoutId = setTimeout(myObj.hideBigBn, hideDelay * 1000);
		hideTimeoutStarted = true;
	};
	this.gotoLink = function() {
		window.open(linkUrl, '');
	};

	this.small_rollOver = function() {
		if (typeof(domReady) != 'undefined' && domReady) {
			myObj.showBigBn();
		}
	};
	this.small_rollOut = function() {
		//
	};
	this.small_release = function() {
		myObj.gotoLink();
	};

	this.big_rollOver = function() {
		if (hideTimeoutStarted) {
			clearTimeout(hideTimeoutId);
		}
	};
	this.big_rollOut = function() {
		myObj.hideBigBnWithDelay();
	};
	this.big_release = function() {
		myObj.gotoLink();
		myObj.hideBigBn();
	};
}

function setTopBnHeight(bnHeight) {
	if (document.getElementById('topBnWideEmptyForAbs')) {
		document.getElementById('topBnWideEmptyForAbs').style.height = '' + bnHeight + 'px';
	}
	if (document.getElementById('topBnWide')) {
		document.getElementById('topBnWide').style.height = '' + bnHeight + 'px';
	}
}

function flashBn(objName, place, bnUrl, linkUrl, bnWidth, bnHeight) {
	bnWidth = '' + bnWidth;
	bnHeight = '' + bnHeight;
	var myObj = this;
	var place = document.getElementById(place);
	var unit;
	if (!isLteFx2()) {
		if (bnWidth.indexOf('%') != -1) { unit = ''; } else { unit = 'px'; }
		place.style.width  = '' + bnWidth  + unit;
		if (bnHeight.indexOf('%') != -1) { unit = ''; } else { unit = 'px'; }
		place.style.height = '' + bnHeight + unit;
		place.style.minHeight = 0;
		if (arguments[6] && arguments[6] == 'wide') {
			place.style.width = '100%';
		}
	}
	if (arguments[7]) {
		document.getElementById('topBnWideEmptyForAbs').style.background = arguments[7];
	}
	/*---*/
	if (arguments[6] && arguments[6] == 'wide') {
		setTopBnHeight(bnHeight);
	}
	/*---*/

	bnUrlOut   = '' + bnUrl   + '?objName=' + objName;

	place.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + bnWidth + '" height="' + bnHeight + '" id="tralala' + objName + '">' + 
				'<param name="movie" value="' + bnUrlOut + '" \/>' +
				'<param name="loop" value="true" \/>' + 
				'<param name="quality" value="high" \/>' + 
				'<param name="bgcolor" value="#FFFFFF" \/>' + 
				'<param name="allowScriptAccess" value="always" \/>' + 
				'<embed src="' + bnUrlOut + '" loop="true" quality="high" bgcolor="#FFFFFF" width="' + bnWidth + '" height="' + bnHeight + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" name="tralala' + objName + '">' + 
				'</embed>' + 
				'</object>';
	this.gotoLink = function() {
		window.open(linkUrl, '');
	}
}