String.prototype.supplant = function(o) {
	return this.replace( /{([^{}]*)}/g, function(a, b) {
			var r = o[b];
			if (typeof r === 'string' || typeof r === 'number')
				return r;
			else
				return a;
		}
	);
}

// center object
jQuery.fn.center = function(){
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}


// pridanie priesvitneho pozadia example: $.overlay(200, 0.5);
jQuery.overlay = jQuery.fn.overlay = function(speed,opacity){
    speed = typeof(speed) != 'undefined' ? speed : 0;
    opacity = typeof(opacity) != 'undefined' ? opacity : 0.5;
    if($("#overlayShadow").length==0){
	$('body').append('<div id="overlayShadow" style="background-color:#000;opacity:0;position:fixed;left:0;right:0;top:0;bottom:0;"></div>');
    }
    $("#overlayShadow").fadeTo(speed,opacity);
    return this;
}


// odstranenie priesvitneho pozadia, example: $.overlayHide(200);
jQuery.overlayHide = jQuery.fn.overlayHide = function(speed){
    speed = typeof(speed) != 'undefined' ? speed : 200;
    $("#overlayShadow").fadeOut(speed,function(){$(this).remove()});
    return this;
}


// AutoScroll preskroluje na triedu ktoru chcem $('.area_name').autoscroll();
jQuery.fn.autoscroll = function(selector){
    $('html,body').animate({ scrollTop:$(selector).offset().top }, 500);
}

