<div class="close_window" onclick="backToPage();"></div>
<div id="inspired-errors" class="errors"  style="display:none;cursor:pointer;">
    <ul>
        <li id="search-empty" style="display:none;"><strong>Search field can't be empty.</strong></li>
    </ul>
</div>
<div id="admineditwhat">{%Get Inspired%}</div>
<?php if(!isset($this->dataEmpty)) {?>
<?php echo $this->form; ?>
<div class="words-list">
    <?php if(isset($this->wholePhrase)) {?>
    <span>For phrase: <?php echo $this->wholePhrase ;?> </span>
    <ul class="whole-phrase">
            <?php
            if(isset($this->synonimsWholePhraseArray)) {
                foreach($this->synonimsWholePhraseArray as $word) {
                    $word['synonym_word']= str_replace('(generic term)', '', $word['synonym_word']);
                    $word['synonym_word']= str_replace('(antonym)', '', $word['synonym_word']);
                    $word['synonym_word']= str_replace('(similar term)', '', $word['synonym_word']);
                    $word['synonym_word']= str_replace('(related term)', '', $word['synonym_word']);
                    echo "<li>".$word['the_root']." &rarr; ".$word['synonym_word']."</li>";
                }
            }else { ?>
        <li>There is nothing found for entered phrase.</li>
            <?php } ?>
    </ul>
    <br/>
        <?php }?>
<?php
    if(isset($this->commonResult)) {
        foreach ($this->commonResult as $key=>$levelOne) {
            echo "<span>For word: ".$key."</span>";
            echo "<ul class='words'>";
            if(!empty($levelOne)) {
                foreach ($levelOne as $value) {
                    $value['synonym_word']= str_replace('(generic term)', '', $value['synonym_word']);
                    $value['synonym_word']= str_replace('(antonym)', '', $value['synonym_word']);
                    $value['synonym_word']= str_replace('(similar term)', '', $value['synonym_word']);
                    $value['synonym_word']= str_replace('(related term)', '', $value['synonym_word']);
                    echo "<li>".$value['the_root']." &rarr; ".$value['synonym_word']."</li>";
                }
            }else {
              echo "There is nothing found for entered word.";
            }
            echo "</ul><br/>";
        }
    }
    ?>
</div>
<?php }else{ ?>
    <div style="margin:0 20px;line-height:20px;">
        I cannot find any synonyms as your Thesaurus table is empty.<br/>
        Let's use the <a href="http://www.openoffice.org/" title="Open Office">openoffice.org</a> open source thesaurus to get some data:<br/>
        1) Download thes_en_US_v2.zip from <a title="Download" href="http://ftp.gwdg.de/pub/misc/openoffice/contrib/dictionaries/thes_en_US_v2.zip"> here</a> or <a title="Download" href="http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries/thes_en_US_v2.zip">here</a>.<br/>
        2) Unzip the file.<br/>
        3) Upload "th_en_US_v2.dat" in your CMS "/public" folder.<br/>
        4) Click "load" and wait, it could take 3 to 4 minutes to insert.<br/>
    </div>
<button id="loadthesaurus" onclick="processThesaurus();" class="formsubmit" style="margin-left:360px;margin-top:20px;">Load</button>
<?php } ?> 
<div id="ajaxBusy" class="success" style="display:none;">Please wait, loading...</div>