Return Asset Type

Hey guys,


I've got an asset returning a couple of IDs from the Asset Pickers on the previous page. I'm able to fetch the content of the first asset, but I know the type of asset it is.



The second asset could be a Site, Standard Page, Folder etc. I need to react differently to each of these situations. Starting from just an Asset ID how do I find out the type of asset selected?

To get the type by getting the asset:

    $assetid = 100;
    $asset = &$GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
    $type = $asset->type();


To get the type without having to load the asset:
    $assetid = 100;
    $asset_info = $GLOBALS['SQ_SYSTEM']->am->getAssetInfo(Array($assetid));
    $type_code = $asset_info[$assetid]['type_code'];