var content = new Class({
    Extends: element,
    Implements: [Options, Events],
    'initialize': function(options) {
        //alert('init content');
        this.parent(options);
        //this.options.chain=true;
        var opts = this.options;
        opts.content = opts.object.getElement('#content');
        opts.showhidetab = opts.content.getNext('div.showhidetab').getElement('img');
        opts.size = opts.object.getSize();
        //console.log(opts.size);
        opts.showhidetab.set('opacity', 0);
        opts.showhidetab.set('morph', { 'duration': 300 });
        opts.showhidetab.addEvents({
            'click': function() { ((this.hidden) ? page.showContent() : page.hideContent()) } .bind(this),
            'mouseenter': function() { this.options.showhidetab.morph('.' + info.site + 'showhidetabglow') } .bind(this),
            'mouseleave': function() { this.options.showhidetab.morph('.' + info.site + 'showhidetabunglow') } .bind(this)
        });
        this.height = opts.size.y;
        //console.log(this.options.morph);
    },
    'hide': function(leftnav) {
        //console.log('content:hide()');
        this.hidden = true;
        this.options.content.morph(((info.homepage == true) ? '.contentsquash' : '.contenthide'));
    	this.options.showhidetab.removeClass('shown');
	},
    'show': function() {
		this.options.showhidetab.addClass('shown');
        //console.log('content:show()');
        this.hidden = false;
        this.options.content.morph(((info.homepage == true) ? { 'height': this.height, 'padding': '30px 20px 20px 20px', 'min-height': '180px'} : '.contentshow'));
    },
    'appear': function() {
		this.options.showhidetab.addClass('shown');
        this.appeared = true;
        this.options.object.set('opacity', 1);
        this.options.showhidetab.morph('.opaque');
        // should be chained?
        (function() { this.options.content.morph('.contentappear') } .bind(this)).delay(500);
    },
    'disappear': function() {
        this.appeared = false;
        this.options.showhidetab.morph('.transparent');
        /* should be chained? */
        (function() { this.options.content.morph('.contentdisappear') } .bind(this)).delay(500);
    },
    'moveTo': function(obj) {
        //displayObj(obj);
        this.options.object.setStyles(obj);

    },
    'alignTo': function(el, h, v) {
        var elcoords = el.getCoordinates();
        var contentcoords = this.options.object.getCoordinates();
        //console.log(coords);
        var leftval = (h == 'right') ? elcoords.left + elcoords.width : elcoords.left;
        var topval = (v == 'bottom') ? elcoords.bottom - contentcoords.height : elcoords.top;
        this.moveTo({ 'left': leftval, 'top': topval });
    }
});
