function LoadDynamicControls(userControlPaths, containerIDs, operations, postLoadOperations, parameters)
{
    Anthem_InvokePageMethod(
        'LoadDynamicControls', 
        [userControlPaths, containerIDs, operations, postLoadOperations, parameters],
        function(result) { } 
    );
}

function RemoveAllOldControlsThenLoadDynamicControls(userControlPaths, containerIDs, operations, postLoadOperations, parameters)
{
    Anthem_InvokePageMethod(
        'RemoveAllOldControlsThenLoadDynamicControls', 
        [userControlPaths, containerIDs, operations, postLoadOperations, parameters],
        function(result) { } 
    );
}

function SaveDynamicControlsData(userControlIDs, postMethod)
{
    for(i=0; i<userControlIDs.length; i++)
    {
        Anthem_InvokeControlMethod(
		    userControlIDs[i],
		    'SaveData',
		    [],
		    function(result) {
		        if(typeof postMethod == "function")
		            postMethod(result);
		    }
	    );
    }
}

function DeleteDynamicControlsData(userControlIDs, postMethod)
{
    for(i=0; i<userControlIDs.length; i++)
    {
        Anthem_InvokeControlMethod(
		    userControlIDs[i],
		    'DeleteData',
		    [],
		    function(result) {
		        if(typeof postMethod == "function")
		            postMethod(result);
		    }
	    );
    }
}

function ClearDynamicControls(userControlIDs, postMethod)
{
    for(i=0; i<userControlIDs.length; i++)
    {
        Anthem_InvokeControlMethod(
		    userControlIDs[i],
		    'ClearControl',
		    [],
		    function(result) {
		        if(typeof postMethod == "function")
		            postMethod(result);
		    }
	    );
    }
}

function CallCustomMethods(userControlIDs, methodNames, methodParameters, postMethod)
{
    for(i=0; i<userControlIDs.length; i++)
    {
        Anthem_InvokeControlMethod(
		    userControlIDs[i],
		    methodNames[i],
		    methodParameters[i],
		    function(result) {
		        if(typeof postMethod == "function")
		            postMethod(result);
		    }
	    );
    }
}

function CallCustomMethod(userControlID, methodName, methodParameters, postMethod)
{
    Anthem_InvokeControlMethod(
	    userControlID,
	    methodName,
	    methodParameters,
	    function(result) {
	        if(typeof postMethod == "function")
	            postMethod(result);
	    }
    );
}

function CallCustomPageMethod(methodName, methodParameters, postMethod)
{
    Anthem_InvokePageMethod(
        methodName, 
        methodParameters,
        function(result) {
	        if(typeof postMethod == "function")
	            postMethod(result);
	    }
    );
}

function convertObjectToString(obj)
{
    var objAsString = "";
    if(obj != null)
    {
        for (var propName in obj)
        {
            objAsString = objAsString + "|" + propName + ":" + obj[propName];
        }
    }
    if(objAsString.length>0)
	    return objAsString.substring(1);
	else
        return "";
}

