/**
 * @author Peter Radics
 */


function cleanweb() {
}

	cleanweb.message = function ( msg ){
		var msgBox = jQuery("<div/>");
		msgBox.attr('id','cleanweb-msg-box').prependTo('body')
		msgBox.css({
			'position': 'fixed',
			'right': '0px',
			'top': '0px',
			'zIndex:': '300000',
			'width:':'200px',
			'height:':'100px',
			'background': '#000'
		})
		msgBox.text( msg ).fadeIn(500).delay(1200).fadeOut(500, function(){  });
	}
	
	
	
	cleanweb.loader = function() {};
	
	cleanweb.destroy_handler = null;
	
	cleanweb.loader.create = function () {
			
			
		/*imageHTML = "<img style=\"margin: 22px 0 0 22px;\" src=\"images/ajax-loader.gif\" id=\"cleanweb-ajax-loader\" />";
					
		msgBoxHTML = "<div id=\"cleanweb-loader\" style=\"width:76px;height:76px;position:fixed;margin-top:0px;margin-left:0px;background:url('images/loader-bg-02.png') top left no-repeat;z-index:100000;\">" + imageHTML + "</div>";
		
		
		
		$(msgBoxHTML).css({
			left: ($('body').width()+100) + "px",
			top: ($('body').height()-100) + "px"
		}).appendTo("body").fadeTo(0,0.0,function(){
			$(this).animate({
				left: ($('body').width()-100) + "px", 
				opacity: "0.4"
			},250);
		})*/
		
		
		$("#content-loader").fadeIn(500);
		
		
	}
	
	cleanweb.loader.destroy = function (ready_function) {
		/*loader = jQuery("#cleanweb-loader");*/
		
		
			if ( ready_function != null ){
					cleanweb.destroy_handler = ready_function;
					cleanweb.destroy_handler();
			}
		/*
		jQuery("#cleanweb-loader").animate({
				left: ($('body').width()+100) + "px",
				opacity: "0.0"
			},250,"swing",function(){
				$(this).remove();
				
				if ( ready_function != null ){
					cleanweb.destroy_handler = ready_function;
					cleanweb.destroy_handler();
				}
					
			})*/
			
			$("#content-loader").fadeOut(500)
		
	
	}
	
	
// center
	
jQuery.fn.center = function (absolute) {
    return this.each(function () {
        var t = jQuery(this);

        t.css({
            position:    absolute ? 'absolute' : 'fixed', 
            left:        '50%', 
            top:        '50%', 
            zIndex:        '100000'
        }).css({
            marginLeft:    '-' + (t.outerWidth() / 2) + 'px', 
            marginTop:    '-' + (t.outerHeight() / 2) + 'px'
        });

        if (absolute) {
            t.css({
                marginTop:    parseInt(t.css('marginTop'), 10) + jQuery(window).scrollTop(), 
                marginLeft:    parseInt(t.css('marginLeft'), 10) + jQuery(window).scrollLeft()
            });
        }
    });
};



// mouse region

function is_region(e,tx,ty,bx,by){
	return (e.pageX >= tx) && (e.pageX <= bx) && (e.pageY >= ty) && (e.pageY <= by);
}
