// JavaScript Document
function Interface(){
    this.showPage = function(id, url) {
        $("#" + id).fadeOut('slow', function() {
            $("#" + id).html('<div style="width:100%;padding-top:50px" align="center"><img src="images/carregando.gif" /></div>').show();
            $("#" + id).load(url, function() {
                $("#" + id).hide();
                $("#" + id).fadeIn(600);
                UpdateAjaxLinks();
            });
            return false;
        });

    }
	this.showImg=function(id,url){
		$("#"+id).html("<img src="+url+">");
		$("#"+id).show();
	}
	this.hidenImg=function(id){
		$("#"+id).hide();
	}
}

function UpdateAjaxLinks() {
    $("a.ajax").each(function(index) {
        var obj = $(this);
        obj.attr('href', 'javascript: new Interface().showPage(\'main\',\'' + $(this).attr('href') + '\');')
        .removeClass('ajax');
    });
    
}
