var _gaq = _gaq || [];
_gaq.push(['_setAccount', analyticsAccount]);
_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script');
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	ga.setAttribute('async', 'true');
	document.documentElement.firstChild.appendChild(ga);
})();

function gaq_push(ga){
	_gaq.push(['_trackPageview', ga]);
}

function openWindow(pageUrl) {
	var winName = Math.round(9999*Math.random()) + new Date().getTime();
	var winNew = window.open(pageUrl,winName,"toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=550");

	if (!winNew) {
		getSwf(swfId).openWindowFromSwf(pageUrl);
	} else {
		winNew.focus();
	}
}

function getSwf(id) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[id];
	} 
	else {
		return document[id];
	}
}

function loadingCallback(e) {
	if(!e.success) {
		window.location = '/noflash'
	}
}

FBC.init(apiKey, 'xd_receiver.html');
FBC.ready(function() {
	FBC.setFlashID("flashtarget");

	var flashVars = FBC.getFlashVars();
	var params = { wmode: "opaque", base: flashUrl, allowScriptAccess: "always", allowFullscreen: "true" };

	for (var i in extraFlashVars) {
		flashVars[i] = extraFlashVars[i];
	}

	swfobject.embedSWF(
		flashUrl + flashFile,
		"flashtarget", 
		"100%",
		flash_object_height,
		"10.0.0", 
		flashUrl + "expressInstall.swf",
		flashVars,
		params,
		{bgcolor: "#000000"},
		loadingCallback
	);
});
