/*
 * 
 * 
 * 
 */

(function($){
    $.fn.MessageBox = function(options) {
        var defaults = { width: 200, height: 200, border:"false", color:"#aabd1e", borderradius:"false", left: 0, padding: 5, text: "", title:"", boxtype:"attention" };
        options  = $.extend(defaults, options);
        $(".messagebox").css("display", "none");
        $(this).each(function(){
            $(this).html("");
            $(this).css("width", parseInt(options['width'])-options['padding']);
            $(this).css("height", parseInt(options['height'])-options['padding']);
            $(this).css("padding", options['padding']+"px");
            
            $(this).css("background-image", 'url(images/grey_bg.png)');
            $(this).css("color", 'white');
            
            if(options['border'] != "false")
                $(this).css("border", options['border']);
            if(options['borderradius'] != "false"){
                $(this).css("border-bottom-right-radius", options['borderradius']+"px");
                $(this).css("border-bottom-left-radius", options['borderradius']+"px");
                $(this).css("-moz-border-radius-bottomright", options['borderradius']+"px");
                $(this).css("-moz-border-radius-bottomleft", options['borderradius']+"px");
                $(this).css("-webkit-border-bottom-right-radius", options['borderradius']+"px");
                $(this).css("-webkit-border-bottom-left-radius", options['borderradius']+"px");
                
            }
            $(this).css("position", 'absolute');
            $(this).css("top", '-'+parseInt(options['border'])+'px');
            $(this).css("left", options['left']);
            
//            $(this).bind("click", function(){
//                $(this).fadeOut("slow");
//            });
            $(this).delay(1000).slideDown("slow", function(){
//                $(this).fadeOut("slow", function(){
////                    $(this).fadeIn("slow", function(){
////                        
////                    });
//                });
            });
            //end css
            if(options['boxtype'] == "attention")
                $(this).append('<img src="images/attention.png" style="float: left; margin-top: 10px; margin-right: 20px;" width="100" /><div style="float:left;width:250px;"><h1 style="color:'+options['color']+'; border-bottom: 1px solid '+options['color']+'; font-family: \'Paytone One\', sans-serif; margin:0 !important;">'+options['title']+'</h1><br />' + options['text'] + '</div><div class="clear"></div>');
            else if(options['boxtype'] == "success")
                 $(this).append('<img src="images/ok.png" style="float: left; margin-top: 10px; margin-right: 20px;" width="100" /><div style="float:left;width:250px;"><h1 style="color:'+options['color']+'; border-bottom: 1px solid '+options['color']+'; font-family: \'Paytone One\', sans-serif; margin:0 !important;">'+options['title']+'</h1><br />' + options['text'] + '</div><div class="clear"></div>');
            });
    };
})(jQuery);

