﻿function renderSwfobject(divId, flashPath, width, height, rootUrl, serviceUrl) {
    rootUrl = unescape(rootUrl);
    serviceUrl = unescape(serviceUrl);
    var flashvars = {
        root: escape(rootUrl),
        service: escape(serviceUrl),
        pathToXml: escape(serviceUrl)
    };

    var params = {
        movie: flashPath,
        quality: 'high',
        wmode: 'transparent',
        scale: 'showall',
        play: 'true',
        loop: 'true',
        menu: 'false',
        devicefont: 'false',
        salign: '',
        allowScriptAccess: 'sameDomain',
        allowFullscreen: 'false',
        scale: 'noScale',
        bgcolor: '#FFFFFF'
    };

    var attributes = {
        id: divId
    };
    swfobject.embedSWF(flashPath, divId, width, height, '10', 'expressInstall.swf', flashvars, params, attributes);
}

// TODO add page flash page tagging routines here.
var isPlaying = false
function flashBtn(arg) {
    if (arg == 0) {
		try {
			if (!_gaq) return;
			if (!isPlaying) {
				isPlaying = true;
				_gaq.push(["_trackEvent", "Video", "Play"]);
			} else {
				isPlaying = false;
				_gaq.push(["_trackEvent", "Video", "Stop"]);
			}
		} catch (e) {
			console.log(e.message);
		}
    }
}
