<?php
$crafts = getCrafts($item['itemid']);
if($crafts == 'empty')
{
}
else
{
echo '<table class="table table-hover"><tr class="table-success"><td><b><center>Crafting Information</center></b></td></tr>';
foreach ($crafts as $craft) {
$alchemy=$craft['Alchemy'];
$bone=$craft['Bone'];
$cloth=$craft['Cloth'];
$cook=$craft['Cook'];
$gold=$craft['Gold'];
$leather=$craft['Leather'];
$smith=$craft['Smith'];
$wood=$craft['Wood'];
$a = array("Alchemy"=>$alchemy, "Bonecraft"=>$bone, "Clothcraft"=>$cloth, "Cooking"=>$cook, "Gold Smithing"=>$gold, "Leathercraft"=>$leather, "Smithing"=>$smith, "Woodworking"=>$wood,);

echo ' <tr class="table-warning"><td>';
foreach ($a as $key => $val ) {
if($val>0){    echo '<a href=?p=crafts&craft='.$key.'>'.$key.' ('.$val.')</a>';
}
}
echo '<a href="?p=items&id='.$craft['Crystal'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['Crystal'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['Crystal']))).'</a> '.ucwords(str_replace('_',' ',$real_keyitems[$craft['KeyItem']])).'</td></tr>';

if($craft['Ingredient1']>0){
echo '
<tr><td>Ingredient: <a href="?p=items&id='.$craft['Ingredient1'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['Ingredient1'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['Ingredient1']))).'</a></td></tr>';
}
if($craft['Ingredient2']>0){
echo '
<tr><td>Ingredient: <a href="?p=items&id='.$craft['Ingredient2'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['Ingredient2'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['Ingredient2']))).'</a></td></tr>';
}
if($craft['Ingredient3']>0){
echo '
<tr><td>Ingredient: <a href="?p=items&id='.$craft['Ingredient3'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['Ingredient3'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['Ingredient3']))).'</a></td></tr>';
}
if($craft['Ingredient4']>0){
echo '
<tr><td>Ingredient: <a href="?p=items&id='.$craft['Ingredient4'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['Ingredient4'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['Ingredient4']))).'</a></td></tr>';
}
if($craft['Ingredient5']>0){
echo '
<tr><td>Ingredient: <a href="?p=items&id='.$craft['Ingredient5'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['Ingredient5'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['Ingredient5']))).'</a></td></tr>';
}
if($craft['Ingredient6']>0){
echo '
<tr><td>Ingredient: <a href="?p=items&id='.$craft['Ingredient6'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['Ingredient6'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['Ingredient6']))).'</a></td></tr>';
}
if($craft['Ingredient7']>0){
echo '
<tr><td>Ingredient: <a href="?p=items&id='.$craft['Ingredient7'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['Ingredient7'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['Ingredient7']))).'</a></td></tr>';
}
if($craft['Ingredient8']>0){
echo '
<tr><td>Ingredient: <a href="?p=items&id='.$craft['Ingredient8'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['Ingredient8'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['Ingredient8']))).'</a></td></tr>';
}
echo '
<tr class="table-active"><td>Results</td></tr>
<tr><td>NQ: <a href="?p=items&id='.$craft['Result'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['Result'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['Result']))).'</a> x '.$craft['ResultQty'].'</td></tr>
<tr><td>HQ: <a href="?p=items&id='.$craft['ResultHQ1'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['ResultHQ1'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['ResultHQ1']))).'</a> x '.$craft['ResultHQ1Qty'].'</td></tr>
<tr><td>HQ2: <a href="?p=items&id='.$craft['ResultHQ2'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['ResultHQ2'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['ResultHQ2']))).'</a> x '.$craft['ResultHQ2Qty'].'</td></tr>
<tr><td>HQ3: <a href="?p=items&id='.$craft['ResultHQ3'].'"><img src=http://static.ffxiah.com/images/icon/'.$craft['ResultHQ3'].'.png height=32 width=32> '.ucwords(str_replace('_',' ',getItemName($craft['ResultHQ3']))).'</a> x '.$craft['ResultHQ3Qty'].'</td></tr>

';


}
echo '
</table>';

}



?>