/*
AppConnector.js : connector to the client
*/
// SendGarment() : send Garment ID to the client app + calles function that derss the avatar
// Remarks : this func is for compability to previous versions
function SendGarment(GarmentId,DbId)
{
//alert(GarmentId + " , " + DbId)
document.AppConnector.SetVariable("bDress", 1);
document.AppConnector.SetVariable("GarmentId", GarmentId);
document.AppConnector.SetVariable("DbId", DbId);
document.AppConnector.SetVariable("bDress", 1); // this line causes calling to the Dress() in the client app
}
// DressOK(): callback functions that is called when the client app recieved the order to dress the avatar
// Remarks : 
//      1. it doesnt dress the avatar yet, but says that it's trying to do that
//      2. this func is for compability to previous versions
function DressOK()
{
//alert("DressOK");
}
//-----------------------------------------------
// this is the sample for dressing for the new app client version v1.00.10
// Dress() : calls to function in the client app that dresses the avatar
// Remark : it uses the Garment ID we allready passed by calling the SendGarment()
// TO_DO : pass here Garment ID and DBID
function Dress(GarmentId,DbId)
{
AppStart();
SendGarment(GarmentId,DbId); // for old versions
document.AppConnector.SetVariable("bDress", 1);
str = GarmentId + "," + DbId;
document.AppConnector.SetVariable("sArgs", str);
document.AppConnector.SetVariable("sCommand", "onDress");
//  alert (oAppConnector)
}
// Remarks : this func is for compability to previous versions
function CommandOK(sCommand,sArgs)
{
HideCtrlById("divProgress");
//alert("CommandOK("+sCommand+","+sArgs)+")";
}
//-----------------------------------------------
function AppOK(sCommand,sArgs)
{
HideCtrlById("divProgress");
//alert("AppOk("+sCommand+","+sArgs+")");
}
//-----------------------------------------------
function NoApp(sCommand,sArgs)
{
//there is a link to retry dressing inside the tryOnDiv - we have to hook it up
var lnkRetryWrapper = document.getElementById("lnkTryOnRetry");
if(lnkRetryWrapper)
{
var arrArgs = sArgs.split(",");//sArgs contains the variables sent to Dress()
if(arrArgs.length == 2)
lnkRetryWrapper.onclick = function () {Dress(arrArgs[0],arrArgs[1]); };
}
HideCtrlById("divProgress");//hide the progress
ShowElem("divNotDesigner", 0, 0);
}
//-----------------------------------------------
function AppStart(sCommand,sArgs)
{
HideCtrlById("divNotDesigner");//if we are retrying - hide the prev err
ShowElem("divProgress", 0, 0);
}
function NoClient(sCommand,sArgs)
{
ShowElem("divNotDesigner", 0, 0);
}
