<?php

	$id = "property";

	$ass = new Asset($_REQUEST['asset']);
	$props = $ass->GetProperties();
	$ass->GetValues($props,true);
	
	$items = array();
	foreach($props as $n)
	{
		if(!isset($n->value['_dynamics']))
		{
			continue;
		}
		$items[$n->name] = $n->id;
	}
	
	ksort($items);
	
	$parents = array();	
	
	$final = array();
		
	foreach($items as $name => $value)
	{
		$bits = explode(" - ",$name);
		if (count($bits) > 1)
		{			
			$thisparent = $bits[0];		
						
			if (!in_array($bits[0],$parents))
			{								
				$final[$bits[0].' (All)'] = $bits[0];
				$parents[] = $bits[0];
			}
			
			$currentparent = $thisparent;
		}
		$final[$name] = $name;		
		
	}	
	
	echo '<option value="">[Choose Property]</option>';
	foreach($final as $k => $v)
	{
		echo '<option value="'.$v.'">'.$k.'</option>';
	}
?>