﻿var ctlAppened ="ctl00_ctl00_IWPContent_backContent_";
    var xmlhttp = false;
    var XMLDoc;
    
    getHTTPRequestObject();
    function getFooter(account_id)
    {
        xmlhttp.open("POST", "http://" + location.host + "/IWPWebService.asmx/checkFooter", true);
        xmlhttp.onreadystatechange = function () {runFunction(writeFooter)};
        xmlhttp.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
        xmlhttp.send("account_id=" + account_id);
    }
    function writeFooter()
    {
        var marketExits;
        var dataNodeList;
        var objNodeList = XMLDoc.getElementsByTagName("ReturnDataSet");
        if (objNodeList.length > 0)
        {
            dataNodeList = objNodeList[0];
            marketExits = true;
        }
        else{marketExits = false;}

        var stringout = "";
        stringout += "<div class=\"spacer\" style=\"height: 30px;\"></div>";
        stringout += "  <div  style=\"float: left; overflow: hidden;\">";
        stringout += "    <div class=\"bottom_hl\">";
        stringout += "	  Place a listing:";
        stringout += "    </div>";
        stringout += "    <div style=\"float: left; overflow: hidden; width: 795px;\">";
        stringout += "    <table style=\"text-align: center; margin-left: 15px; width: 780px;\">";
        stringout += "      <tr>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <img src=\"images/lst_markets.jpg\" style=\"width: 86px; height: 74px;\" alt=\"Markets\" />";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <img src=\"images/lst_employment.jpg\" style=\"width: 86px; height: 74px;\" alt=\"Employment\" />";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <img src=\"images/lst_business.jpg\" style=\"width: 86px; height: 74px;\" alt=\"Business for Sale\" />";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <img src=\"images/lst_suppliers.jpg\" style=\"width: 86px; height: 74px;\" alt=\"Suppliers\" />";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <img src=\"images/lst_classified.jpg\" style=\"width: 86px; height: 74px;\" alt=\"Classifieds\" />";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <img src=\"images/lst_eduation.jpg\" style=\"width: 86px; height: 74px;\" alt=\"Education\" class=\"grey_out\" />";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <img src=\"images/lst_events.jpg\" style=\"width: 86px; height: 74px;\" alt=\"Events\" class=\"grey_out\" />";
        stringout += "        </td>";
        stringout += "      </tr>";
        stringout += "      <tr><td colspan='7' class=\"spacer\"></td></tr>";
        stringout += "      <tr>";
        if(marketExits)
        {
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <a href=\"marketEdit.aspx?ml=" + getParsedElement(dataNodeList, "master_listing_id") + "\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            Edit listing";
        stringout += "          </a>";
        stringout += "        </td>";
        }
        if(!marketExits)
        {
        stringout += "        <td class=\"icon_footer_grey\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            Edit listing";
        stringout += "        </td>";
        }
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <a href=\"employmentEdit.aspx\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            Add listing";
        stringout += "          </a>";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <a href=\"maEdit.aspx\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            Add listing";
        stringout += "          </a>";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer_grey\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            Edit listing";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <a href=\"classifiedEdit.aspx\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            Add listing";
        stringout += "          </a>";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">&nbsp;</td>";
        stringout += "        <td class=\"icon_footer\">&nbsp;</td>";
        stringout += "      </tr>";
        stringout += "      <tr>";
        if(marketExits)
        {
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <a href=\"productsEdit.aspx?ml=" + getParsedElement(dataNodeList, "master_listing_id") + "\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            Edit products";
        stringout += "          </a>";
        stringout += "        </td>";
        }
        if(!marketExits)
        {
        stringout += "        <td class=\"icon_footer_grey\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            Edit products";
        stringout += "        </td>";
        }
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <a href=\"employment.aspx\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            View listings";
        stringout += "          </a>";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <a href=\"ma.aspx\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            View listings";
        stringout += "          </a>";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer_grey\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            Edit products";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <a href=\"classifieds.aspx\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            View listings";
        stringout += "          </a>";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">&nbsp;</td>";
        stringout += "        <td class=\"icon_footer\">&nbsp;</td>";
        stringout += "      </tr>";
        stringout += "      <tr>";
        stringout += "        <td class=\"icon_footer\">";
        stringout += "          <a href=\"market.aspx\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            View listings";
        stringout += "          </a>";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">&nbsp;</td>";
        stringout += "        <td class=\"icon_footer\">&nbsp;</td>";
        stringout += "        <td class=\"icon_footer_grey\">";
        stringout += "            <img src=\"images/arw_orange.gif\" alt=\">\" />";
        stringout += "            View listings";
        stringout += "        </td>";
        stringout += "        <td class=\"icon_footer\">&nbsp;</td>";
        stringout += "        <td class=\"icon_footer\">&nbsp;</td>";
        stringout += "        <td class=\"icon_footer\">&nbsp;</td>";
        stringout += "      </tr>";
        stringout += "    </table>";
        stringout += "    </div>";
        stringout += "  </div><!--End Bottom Edit-->";
        stringout += "<div class=\"spacer\" style=\"height: 30px;\"></div>";
        document.getElementById(ctlAppened + "footer").innerHTML = stringout;
    }    
