var STWD_GLOBAL_URL = "http://mars.stanuschtechnologies.pl/aio/bots/player3/";
var STWD_CATALOG_URL = "plusc";
var STWD_ACTION_ID = "";
var STWD_OPEN_BEHAVIOR = "usecookie";
var STWD_COOKIE_NAME = 'stwd_isopen';

function STWD_Embed(elementId, actionId)
{
    $('#'+elementId).append("<div id='stContent'><p>You need Flash Player 9 or greater: <a href='http://get.adobe.com/flashplayer/?promoid=DAFYL'>http://get.adobe.com</a></p></div>");
    if (!actionId) actionId = "";
    STWD_ACTION_ID = actionId;
    STWD_OpenWd(actionId);
}

function STWD_OpenWd(actionId)
{
    if( !actionId ) actionId = "";
    STWD_ACTION_ID = actionId;
	var flashvars = {
		skin: STWD_GLOBAL_URL + STWD_CATALOG_URL +"/avatar.swf",
		configfile: STWD_GLOBAL_URL + STWD_CATALOG_URL + "/avatar.xml",
		engine: STWD_GLOBAL_URL + "Common/engine.swf",
		startQuestion: actionId
	};
	var params = {
		menu: "false",
		wmode: "transparent",
		allowScriptAccess: "always"
	};
	var attributes = {
		id: "wd",
		name: "wd"
	};
	swfobject.embedSWF(STWD_GLOBAL_URL + STWD_CATALOG_URL + "/loader.swf", "stContent", "654", "250", "9","../Common/expressInstall.swf", flashvars, params, attributes);
}

function STWD_CloseWd()
{
    swfobject.removeSWF("wd");
}

function STWD_OpenData(param) {
    if (param.toString().indexOf('categoryId:') != -1) {
        try {
            var categoryId = param.toString().substr(11, param.length - 11);
            searchCategory(categoryId);
        }
        catch (e) {
            alert("Błędny id kategorii:" + param);
        }
    }
    else {
        window.open(param, "_self");
    }

}

function STWD_Answer(question) 
{
	try {document.getElementById("wd").answerQuestion(question);}
	catch (e) {alert(e);}
}

