// This mootools plugin creates charity banners for your website

var mooCharityBanner = new Class({
    Implements: Options,
    options: {
        image: 'content/img/charity/unicef.jpg',
        href: 'http://www.supportunicef.org',
        alt: 'Unicef',
        angle: 45.0,
        scale: 0.8,
        positionx: 0,
        positiony: 0,
        width: 200,
        height: 200
    },
    initialize: function( options ){
        this.setOptions( options );
    },
    draw: function()
    {
        var canvas = new Element( 'canvas', {
            'width': 200,
            'height': 200,
            'styles': {
                // 'background-color': 'rgba( 200, 30, 40, 0.5 )',
                'z-index': '10',
                'width': 200,
                'height': 200,
                'overflow': 'hidden',
                'position': 'absolute',
                'top': '0px',
                'right': '0px'
            }
        });
        
        canvas.inject( $(document.body), 'top' );
        
        var ctx = canvas.getContext("2d");
    
        var img = new Image();  
        img.onload = function(){ 
            ctx.scale( 0.8, 0.8 );
            ctx.rotate( 45.0*(Math.PI/180.0) );
            ctx.drawImage( img, -10, -60 );
        }
        img.src = this.options.image ;
    }
})

