xmlhttp = new XMLHTTP(); var upbg = false; var ajax = { upValor : function(cmd) { num = document.getElementById('n1'+cmd).innerHTML-1; document.getElementById('n1'+cmd).innerHTML = num; document.getElementById('n2'+cmd).innerHTML = num; document.getElementById('n3'+cmd).innerHTML = num; }, close : function(div) { document.getElementById(div).style.display = 'none'; }, abrir : function(div) { document.getElementById(div).style.display = 'block'; }, acion : function(div) { div = document.getElementById(div); if (div.style.display == 'none') { div.style.display = 'block'; }else{ div.style.display = 'none'; } }, upbg : function(idbg,idpg,div){ upbg = true; ajax.close(div); param = "upbg="+idbg+"&idpg="+idpg; xmlhttp.open('POST', '/php/ajax.php', true); xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xmlhttp.send(param); document.getElementById('view-bg').style.background = "url('/foto/bg/"+idbg+"-mini.jpg') repeat"; }, adbg : function(img){ if (img == 0) { document.body.style.background = document.getElementById('salve-bg').value; }else if (img == 23) { document.body.style.background = "#000 url('/foto/bg/"+img+"-normal.jpg') repeat-x"; }else{ document.body.style.background = "url('/foto/bg/"+img+"-normal.jpg') repeat"; } }, bgbody : function(idpg,div,w){ upbg = false; var html = ''; ajax.acion(div); id = document.getElementById(div); document.getElementById('salve-bg').value = document.body.style.background; for (i = 1; i <= 36; i++){ html += ''; } id.innerHTML = html; }, iam : function(id_am,div){ param = "iam="+id_am; xmlhttp.open('POST', 'php/ajax.php', true); xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { resposta = unescape(xmlhttp.responseText); div.innerHTML = resposta; } } xmlhttp.send(param); }, seg : function(id,div,acao){ if (acao == 1) { param = "isg="+id; }else{ param = "xsg="+id; } xmlhttp.open('POST', 'php/ajax.php', true); xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { resposta = unescape(xmlhttp.responseText); div.innerHTML = resposta; } } xmlhttp.send(param); }, row : function(txr) { txr.style.height = txr.scrollHeight+'px'; }, pal : function() { var txt = ''; if (window.getSelection) { txt = window.getSelection(); } else if (document.getSelection) { txt = document.getSelection(); } else if (document.selection) { txt = document.selection.createRange().text; }else return; return txt; }, buscar : function(url,pal) { if (pal == "" || url == "") return; document.location.href = "buscar.do?id=" + url + "&q=" + pal; } }