--- functions.php	2013-04-14 22:27:19.000000000 +0200
+++ /var/www/racktables-bg-dev/inc/functions.php	2013-04-30 10:31:39.241319845 +0200
@@ -6045,4 +6045,21 @@
 	return FALSE;
 }
 
+// print tree in select options for locations
+function printLocationChildren($locations,$lvl = 0, $sel = 0)
+{
+        $lvl++;
+        foreach ($locations['kids'] as $subLocation)
+        {
+                echo "<option value=${subLocation['id']}";
+                if ($subLocation['id'] == $sel)
+                        echo " selected ";
+                echo ">" . str_repeat("&raquo; ",$lvl) . "${subLocation['name']}</option>";
+
+                if($subLocation['kidc'] > 0)
+                        printLocationChildren($subLocation,$lvl,$sel);
+        }
+}
+
+
 ?>
