require_once '../../../php/EPCharacterCreator.php';
include '../other/bookPageLayer.php';
session_start();
$currentMorph = $_SESSION['cc']->getCurrentMorphsByName($_SESSION['currentMorph']);
?>
<label class="descriptionTitle"><?php 
echo $currentMorph->name;
?>
</label>
<ul class="mainlist" id="morphNegtraits">
    <li><label class='foldingListSection'>Morph Neutral Traits</label></li>
	<?php 
$currentTraits = $_SESSION['cc']->getCurrentMorphTraits($_SESSION['currentMorph']);
$defaultTrait = $_SESSION['cc']->getCurrentDefaultMorphTraits($currentMorph);
foreach ($_SESSION['cc']->getTraits() as $m) {
    if ($m->traitEgoMorph == EPTrait::$MORPH_TRAIT && isTraitLegal($currentMorph, $m) && $m->cpCost == 0) {
        echo "<li>";
        if ($defaultTrait != null && $_SESSION['cc']->isAtomInArrayByName($m->name, $defaultTrait)) {
            echo "\t\t<label class='morphNegTrait selNeuTrait' id='" . $m->name . "'>" . $m->name . getListStampHtml($m->name) . "</label><label class='costInfo'>(Granted)</label><span class='selectedicone selNeuTrait selMorphNeuTraitIcon' id='" . $m->name . "' data-icon='&#x2b;'></span>";
        } else {
            if ($currentTraits != null && $_SESSION['cc']->isAtomInArrayByName($m->name, $currentTraits)) {
                echo "\t\t<label class='morphNeuTrait selNeuTrait' id='" . $m->name . "'>" . $m->name . getListStampHtml($m->name) . "</label><span class='selectedicone selNeuTrait selMorphNeuTraitIcon' id='" . $m->name . "' data-icon='&#x2b;'></span>";
            } else {
                echo "\t\t<label class='morphNeuTrait' id='" . $m->name . "'>" . $m->name . getListStampHtml($m->name) . "</label><span class='addIcon addMorphNeuTraitIcon' id='" . $m->name . "' data-icon='&#x3a;'></span>";
            }
        }
        echo "</li>";
    }
}
function isTraitLegal($morph, $trait)
{
require_once '../../../php/EPCharacterCreator.php';
include '../other/bookPageLayer.php';
session_start();
$currentMorph = $_SESSION['cc']->getCurrentMorphsByName($_SESSION['currentMorph']);
?>
<label class="descriptionTitle"><?php 
echo $currentMorph->name;
?>
</label>
<ul class="mainlist" id="morphPostraits">
    <li><label class='foldingListSection'>Morph Pos. Traits</label></li>
	<?php 
$currentTraits = $_SESSION['cc']->getCurrentMorphTraits($_SESSION['currentMorph']);
$defaultTrait = $_SESSION['cc']->getCurrentDefaultMorphTraits($currentMorph);
foreach ($_SESSION['cc']->getTraits() as $m) {
    if ($m->traitPosNeg == EPTrait::$POSITIVE_TRAIT && $m->traitEgoMorph == EPTrait::$MORPH_TRAIT && isTraitLegal($currentMorph, $m) && $m->cpCost > 0) {
        echo "<li>";
        if ($defaultTrait != null && $_SESSION['cc']->isAtomInArrayByName($m->name, $defaultTrait)) {
            echo "\t\t<label class='morphPosTrait selPosTrait' id='" . $m->name . "'>" . $m->name . getListStampHtml($m->name) . "</label><label class='costInfo'>(Granted)</label><span class='selectedicone selPosTrait selMorphPosTraitIcon' id='" . $m->name . "' data-icon='&#x2b;'></span>";
        } else {
            if ($currentTraits != null && $_SESSION['cc']->isAtomInArrayByName($m->name, $currentTraits)) {
                echo "\t\t<label class='morphPosTrait selPosTrait' id='" . $m->name . "'>" . $m->name . getListStampHtml($m->name) . "</label><label class='costInfo'>(" . $m->cpCost . " cp)</label><span class='selectedicone selPosTrait selMorphPosTraitIcon' id='" . $m->name . "' data-icon='&#x2b;'></span>";
            } else {
                echo "\t\t<label class='morphPosTrait' id='" . $m->name . "'>" . $m->name . getListStampHtml($m->name) . "</label><label class='costInfo'>(" . $m->cpCost . " cp)</label><span class='addIcon addMorphPosTraitIcon' id='" . $m->name . "' data-icon='&#x3a;'></span>";
            }
        }
        echo "</li>";
    }
}
function isTraitLegal($morph, $trait)
{