var myHref = "http://www.indexjuridico.com.br";
var myHrefImg = "http://www.indexjuridico.com.br/img";
function xmlhttplocal(){
var oxmlhttplocal;
try{
if (window.XMLHttpRequest){
oxmlhttplocal = new XMLHttpRequest();
}
}
catch (e){
oxmlhttplocal = false;
}
try{
if (window.ActiveXObject){
oxmlhttplocal = new ActiveXObject("Microsoft.XMLHTTP");
}
}
catch (e){
oxmlhttplocal = false;
}
return (oxmlhttplocal);
}
function vote(e, b, n, oid, md5){
var myUrl = myHref + "/vote.asp";
var myContent = "e=" + e + "&n=" + n + "&md5=" + md5;
var myXmlReq = Array ();
var myReturn = 0;
var myImgProcess = "
";
if (!b){
document.location.href = myHref + "/cadastro.asp";
}else{
myXmlReq[oid] = new xmlhttplocal();
if (myXmlReq){
myXmlReq[oid].onreadystatechange = function( ){
if (myXmlReq[oid].readyState == 4) {
if (myXmlReq[oid].status == 200) {
myReturn = myXmlReq[oid].responseText;
var targetbox = document.getElementById( 'x-voto-box-' + oid );
var targetlink = document.getElementById( 'x-voto-link-' + oid );
if (myReturn != -1){
targetbox.innerHTML = "" + myReturn + "";
if (e == '_vote'){
targetlink.innerHTML = "Retirar Voto";
}else{
targetlink.innerHTML = "Votar";
}
}else{
targetlink.innerHTML = "Votar";
}
} else{
alert("Problemas com o servidor:\n " + myXmlReq[oid].statusText);
}
}else{
document.getElementById('x-voto-link-' + oid).innerHTML = myImgProcess;
}
}
try {
myXmlReq[oid].open("POST", myUrl, true);
myXmlReq[oid].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
} catch (e) {
alert("Erro de comunicação:\n"+e);
}
myXmlReq[oid].send(myContent);
}
}
}
function denuncia(n, oid, md5){
var myUrl = myHref + "/denuncia.asp";
var myContent = "n=" + n + "&md5=" + md5;
var myXmlReq = Array ();
var myReturn = 0;
var myImgProcess = "
";
myXmlReq[oid] = new xmlhttplocal();
if (myXmlReq[oid]){
var targetdenunciabox = document.getElementById( "x-denuncia-box-" + oid );
var targetdenuncialink = document.getElementById( "x-denuncia-link-" + oid );
myXmlReq[oid].onreadystatechange = function( ){
if (myXmlReq[oid].readyState == 4) {
if (myXmlReq[oid].status == 200) {
myReturn = myXmlReq[oid].responseText;
if (myReturn == 0){
targetdenuncialink.innerHTML = " Obrigado! Nossos moderadores avaliarão esta publicação.";
targetdenunciabox.className = "denunciado";
}else if (myReturn == -1){
document.location.href = myHref + "/cadastro.asp";
}else if (myReturn == 0){
targetdenuncialink.innerHTML = "Denunciar Erro interno";
}
} else{
alert("Problemas com o servidor:\n " + myXmlReq[oid].statusText);
}
}else{
}
}
try {
myXmlReq[oid].open("POST", myUrl, true);
myXmlReq[oid].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
} catch (e) {
alert("Erro de comunicação:\n"+e);
}
myXmlReq[oid].send(myContent);
}
}
function add_remove_noticia(e, n, oid){
var myUrl = myHref + "/salvar_remover_noticia.asp";
var myContent = "e=" + e + "&n=" + n;
var myXmlReq = Array ();
var myReturn = 0;
var myLinkNews = "";
var myImgProcess = "
";
myXmlReq[oid] = new xmlhttplocal();
if (myXmlReq){
myXmlReq[oid].onreadystatechange = function( ){
if (myXmlReq[oid].readyState == 4) {
if (myXmlReq[oid].status == 200) {
myReturn = myXmlReq[oid].responseText;
document.getElementById('x-save-' + oid).innerHTML = changelink(e, n, oid, myReturn);
} else {
alert("Problemas com o servidor:\n " + myXmlReq[oid].statusText);
}
}else{
document.getElementById('x-save-' + oid).innerHTML = myImgProcess;
}
}
try {
myXmlReq[oid].open("POST", myUrl, true);
myXmlReq[oid].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
} catch (e) {
alert("Erro de comunicação:\n" + e);
}
myXmlReq[oid].send(myContent);
}
}
function changelink(e, n, oid, r){
var myLink;
if (r > 0){
if (e == '_remove'){
myLink = "
" +
"" +
" Adicionar às Favoritas" +
" " +
"Feito » Ir para minhas favoritas! ";
}
else if (e == '_add'){
myLink = "
" +
"" +
" Remover das Favoritas" +
" " +
"Feito » Ir para minhas favoritas! ";
}
}
else {
if (e == '_remove'){
myLink = "
" +
"" +
" Adicionar às Favoritas" +
" " +
"Erro interno!";
}
else if (e == '_add'){
myLink = "
" +
"" +
" Remover das Favoritas " +
" " +
"Erro interno";
}
}
return (myLink);
}
function showboxcomment(e, n, oid){
var myBoxHTML = "";
if (e == "comment"){
myBoxHTML = "
" + myReturn + "";
document.getElementById("xl-" + e + "-" + oid).appendChild(myCmm);
if (e.indexOf("comment") != -1){
document.getElementById("x-" + e + "-" + oid).innerHTML = "

";
} else {
document.getElementById("x-" + e + "-" + oid).innerHTML = "";
}
}
} else{
alert("Problemas com o servidor:\n " + myXmlReq[oid].statusText);
}
}else{
}
}
try {
myXmlReq[oid].open("POST", myUrl, true);
myXmlReq[oid].setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
} catch (e) {
alert("Erro de comunicação:\n"+e);
}
myXmlReq[oid].send(myContent);
}
}
function add_remove_amigo(e, id, oid){
var myUrl = myHref + "/adicionar_remover_amigo.asp";
var myContent = "e=" + e + "&id=" + id;
var myXmlReq = Array ();
var myReturn = 0;
var myLinkNews = "";
var myImgProcess = "

";
myXmlReq[oid] = new xmlhttplocal();
if (myXmlReq){
myXmlReq[oid].onreadystatechange = function( ){
if (myXmlReq[oid].readyState == 4) {
if (myXmlReq[oid].status == 200) {
myReturn = myXmlReq[oid].responseText;
document.getElementById('x-friend-' + oid).innerHTML = changebtnfriend(e, id, oid, myReturn);
} else {
alert("Problemas com o servidor:\n " + myXmlReq[oid].statusText);
}
}else{
document.getElementById('x-friend-' + oid).innerHTML = myImgProcess;
}
}
try {
myXmlReq[oid].open("POST", myUrl, true);
myXmlReq[oid].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
} catch (e) {
alert("Erro de comunicação:\n" + e);
}
myXmlReq[oid].send(myContent);
}
}
function voto_cmm(e, b, n, oid){
var myUrl = myHref + "/voto_comentario.asp";
var myContent = "e=" + e + "&n=" + n + "&t=_cmm"
var myXmlReq = Array ();
var myReturn = "";
var myVoto = "";
var myImgProcess = "

";
if (b != -1)
document.location.href= myHref + "/cadastro.asp";
else {
myXmlReq[oid] = new xmlhttplocal();
if (myXmlReq){
myXmlReq[oid].onreadystatechange = function( ){
if (myXmlReq[oid].readyState == 4) {
if (myXmlReq[oid].status == 200) {
myReturn = myXmlReq[oid].responseText;
myVoto = myReturn.split(";");
switch (myVoto[0]){
case "resultado":
document.getElementById("x-voto-" + oid).innerHTML = "+" + myVoto[1] + " / -" + myVoto[2];
break;
case "erro":
document.getElementById("x-voto-" + oid).innerHTML = "Parâmetro inválido";
break;
case "erro_interno":
document.getElementById("x-voto-" + oid).innerHTML = "Erro interno, tente novamente!";
break;
case "nao_logado":
document.location.href= myHref + "/cadastro.asp";
break;
}
} else {
alert("Problemas com o servidor:\n " + myXmlReq[oid].statusText);
}
}else{
document.getElementById("x-voto-" + oid).innerHTML = myImgProcess;
}
}
try {
myXmlReq[oid].open("POST", myUrl, true);
myXmlReq[oid].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
} catch (e) {
alert("Erro de comunicação:\n" + e);
}
myXmlReq[oid].send(myContent);
}
}
}
function voto_rcmm(e, b, n, oid){
var myUrl = myHref + "/voto_comentario.asp";
var myContent = "e=" + e + "&n=" + n + "&t=_rcmm"
var myXmlReq = Array ();
var myReturn = "";
var myVoto = "";
var myImgProcess = "

";
if (b != -1)
document.location.href= myHref + "/cadastro.asp";
else {
myXmlReq[oid] = new xmlhttplocal();
if (myXmlReq){
myXmlReq[oid].onreadystatechange = function( ){
if (myXmlReq[oid].readyState == 4) {
if (myXmlReq[oid].status == 200) {
myReturn = myXmlReq[oid].responseText;
myVoto = myReturn.split(";");
switch (myVoto[0]){
case "resultado":
document.getElementById("x-voto-r-" + oid).innerHTML = "+" + myVoto[1] + " / -" + myVoto[2];
break;
case "erro":
document.getElementById("x-voto-r-" + oid).innerHTML = "Parâmetro inválido";
break;
case "erro_interno":
document.getElementById("x-voto-r-" + oid).innerHTML = "Erro interno, tente novamente!";
break;
case "nao_logado":
document.location.href= myHref + "/cadastro.asp";
break;
}
} else {
alert("Problemas com o servidor:\n " + myXmlReq[oid].statusText);
}
}else{
document.getElementById("x-voto-r-" + oid).innerHTML = myImgProcess;
}
}
try {
myXmlReq[oid].open("POST", myUrl, true);
myXmlReq[oid].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
} catch (e) {
alert("Erro de comunicação:\n" + e);
}
myXmlReq[oid].send(myContent);
}
}
}
function changebtnfriend(e, id, oid, r){
var myButton;
if (r > 0){
if (e == '_add'){
myButton = "

";
}else if (e == '_remove'){
myButton = "

";
}
}else{
if (e == '_add'){
myButton = "

";
}else if (e == '_remove'){
myButton = "

";
}
}
return (myButton);
}
function captcha( p, oid ){
var myUrl = myHref + "/gcaptcha.asp?" + p;
var myContent = p;
var myXmlReq = Array ();
var myReturn = 0;
var myLinkNews = "";
myXmlReq[oid] = new xmlhttplocal();
if (myXmlReq){
myXmlReq[oid].onreadystatechange = function( ){
if (myXmlReq[oid].readyState == 4) {
if (myXmlReq[oid].status == 200) {
myReturn = myXmlReq[oid].responseText;
document.getElementById('x-image-' + oid).src = myHref + "/captcha.asp?c=" + p + "&" + myReturn;
} else {
alert("Problemas com o servidor:\n " + myXmlReq[oid].statusText);
}
}else{
document.getElementById('x-image-' + oid).src = myHrefImg + "/it_loadinfo.gif";
}
}
try {
myXmlReq[oid].open("POST", myUrl, true);
myXmlReq[oid].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
} catch (e) {
alert("Erro de comunicação:\n" + e);
}
myXmlReq[oid].send(myContent);
}
}