function clearLayout(layt) {   //takes a layout as an argument    var allobjs = app.GetObjects();   var obj, order;    //loop through all controls    for (var id in allobjs)    {        obj = allobjs[id]        //check if control is on our layout        order = layt.GetChildOrder( obj );        if( order > -1 )        {            //got one!            layt.DestroyChild( obj );        }     } }