<div class="overlay-example" id="overlay-stdmod">
    <div id="overlay" class="yui3-overlay-loading">
        <div class="yui3-widget-hd">Overlay Header</div>
        <div class="yui3-widget-bd">Overlay Body</div>
        <div class="yui3-widget-ft">Overlay Footer</div>
    </div>

    <div class="fields">
        <div>
            <label for="content">New content:</label>
            <textarea name="content" id="content"></textarea>
            <p>
            <strong>Note:</strong> while <a href="#setting-content">Overlay accepts HTML strings and Nodes</a> as content, for this example, all HTML will be escaped.
            </p>
        </div>
        <p>
            <label for="section">Section to add content to:</label>
            <select name="section" id="section">
                <option value="header">Header</option>
                <option value="body">Body</option>
                <option value="footer">Footer</option>
            </select>
        </p>
        <p>
            <label for="where">Replace, insert before or append after existing content:</label>
            <select name="where" id="where">
                <option value="before">Before</option>
                <option value="after">After</option>
                <option value="replace">Replace</option>
            </select>
        </p>
        <button type="button" id="setHTML">Set Content</button>
    </div>
    <div class="filler">
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed tellus pede, aliquet vitae, faucibus quis, lobortis non, metus. Pellentesque at metus ac mi condimentum egestas. In vel neque a massa porttitor ultrices. Nunc lorem. Vivamus ullamcorper fringilla tortor. Etiam at nunc pellentesque lectus cursus pretium. Integer velit. In quis nunc eget leo rhoncus scelerisque. In in ante ac ante pharetra vestibulum. Praesent sit amet metus. Nam egestas ipsum. Nulla facilisi. Quisque rhoncus, eros sed convallis faucibus, erat felis pretium nisi, non bibendum magna mauris non metus. Integer mauris eros, volutpat non, pretium vitae, rutrum at, tellus.
    </div>
</div>

<script type="text/javascript">
YUI().use("overlay", "escape", function(Y) {

    var overlay = new Y.Overlay({
        srcNode:"#overlay",
        width:"20em",
        align: {
            node:"#overlay-stdmod > .filler",
            points:["tl", "tl"]
        }
    });
    overlay.render();

    var content = Y.one("#content");
    var where = Y.one("#where");
    var section = Y.one("#section");

    Y.on("click", function() {
        var newContent = Y.Escape.html(content.get("value"));
        overlay.setStdModContent(section.get("value"), newContent, where.get("value"));
    }, "#setHTML");
});
</script>
