var img=new Image();
img.src="img/spinner.gif";

jQuery.fn.spinner = function() 
{
	h=this.height();
	if (h<24)
		h=24;
	w=this.width();
	if (w<24)
		w=24;
	this.html('<div style="height: '+h+'px; width: '+w+'px; background: center no-repeat url('+img.src+')"></div>'); 	
};

jQuery.fn.loads = function(url, msgOk, msgErr) 
{
	$(this).spinner();
	
	if (url.href)
		url=url.href;
	else
		url=base+url;
		
	id=this;
	$.get(url, function(data){
	    if (typeof msgOk == 'undefined') 
	    	$(id).html(data);
	    else
	    {
	    	if (data.substr(0,2)=='ok')
	    		$(id).html(msgOk);
	    	else
	    	{
	    		if (typeof msgErr != 'undefined') 
	    			$(id).html(msgErr);
	    		else
	    			$(id).html(msgOk);
		    }
	    }
	});
};

function l(msg)
{
	console.log(msg);
}
