var PERSONAGEM = '';
var TIPO = '';

function showPersonagem(obj, tipo) {
    PERSONAGEM = obj;
    TIPO = tipo;
    img = obj.img;
    loadPerData(img);
}

function montaPersonagens() {
    document.getElementById('aut_per_tit_'+TIPO).innerHTML = '<a hr'+'ef="' + PERSONAGEM.link + '">' + PERSONAGEM.title + '<'+'/a>';
    document.getElementById('aut_per_img_'+TIPO).innerHTML = '<a hr'+'ef="' + PERSONAGEM.link + '"><img src="" id="tag_img_per_' +TIPO+ '" alt="" class="foto" '+'/><'+'/a>';
    document.getElementById('tag_img_per_'+TIPO).src = PERSONAGEM.img;
}


function loadPerData(url) {
    if (window.XMLHttpRequest) {
        xmlhttp_per = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        xmlhttp_per = new ActiveXObject("Microsoft.XMLHTTP")
    } else {
        alert('Seu browser não suporta os recursos utilizados por este site.');
    }
    if (xmlhttp_per) {
        xmlhttp_per.onreadystatechange = xmlhttpChange_per;
        xmlhttp_per.open("GET", url, true);
        xmlhttp_per.send(null);
    }

}

function xmlhttpChange_per() {
    if (xmlhttp_per.readyState==4) {
        if (xmlhttp_per.status==200) {
            montaPersonagens();
        } 
    }
}

function changeCSS(elementId, css){
    var element = document.getElementById(elementId);
    element.className = css;
}