Modal Window for jsFiddle (no CSS animation)

Modal Window for jsFiddle

by Oski Krawczyk

HTML

<a id="open" href="#">Open modal</a>
<hr />
<div id="modal-a" class="modalWrap">
    <div class="modalHeading">
        <h3>Lorem ipsum</h3>
        <a class="close" href="#">Close window</a>
    </div>
    <div class="modalBody">
        <textarea></textarea>
    </div>
</div>

CSS

.modalWrap {
    opacity: 0;
}

body {
    background: url(http://farm3.static.flickr.com/2052/1603973924_c61c6bf3a1.jpg);
    font-family: "Lucida Grande", sans-serif;
}

.modalHeading {
    position: relative;
    background: #32648F url(http://img691.imageshack.us/img691/4270/96006254.png) 0 0 repeat-x;
    height: 39px;
    -moz-border-radius-topleft: 6px;
    -moz-border-radius-topright: 6px;
    -webkit-border-top-left-radius: 6px;
    -webkit-border-top-right-radius: 6px;    
}

.close {
    background: url(http://img41.imageshack.us/img41/4012/27262087.png) 0 0 no-repeat;
    width: 12px;
    height: 13px;
    display: block;
    position: absolute;
    top: 13px;
    left: 10px;
    text-indent: -9000em;
}

.modalWrap {
    position: relative;
    padding: 0;
    border: solid 2px #32648F;
    border: solid 10px rgba(0,0,0,0.3);
    -webkit-border-radius: 15px;
    -moz-border-radius: 15px;
    float: left;
    opacity: 0;
}

.modalBody {
    position: relative;
    -webkit-border-bottom-left-radius: 6px;
    -webkit-border-bottom-right-radius: 6px;
    -moz-border-radius-bottomleft: 6px;
    -moz-border-radius-bottomright: 6px;
    background: #fff;
    padding: 10px;
}

textarea {
    display: block;
    border: solid 1px #ADADAD;
    height: 100px;
    width: 250px;
    background: url(http://img685.imageshack.us/img685/3267/62399046.png) 0 0 repeat-x;
}
hr {
    clear: both;
    width: 100%
}

a {
    color: #fff;
}

h3 {
    color: #fff;
    text-shadow: 0 1px 0 #183048;
    text-align: center;
    font-size: .8em;
    padding: 9px 0;
}

JavaScript

Element.implement({
    closeModal: function(){
            this.fade('out');
    },
    
    openModal: function(){
            this.fade('in');
    }
});

$$('.close').each(function(el){
    el.addEvents({
        click: function(e){
            e.stop();
            this.getParent('.modalWrap').closeModal();
        }
    });
});

$('open').addEvents({
    click: function(e){  
        e.stop();
        $$('.modalWrap')[0].openModal();
    }
});

var myDrag = new Drag.Move('modal-a', {
    handle: $$('.modalHeading')
});