function checkup() {
if (!d.voto[0].checked && !d.voto[1].checked) {alert('Para comentar é necessário que você vote em positivo ou negativo.'); return false;}
else if (d.comentario.value.length>255) {alert('O comentário que você digitou ultrapassou a marca permitida de 255 caracteres.'); d.comentario.focus(); return false;}
return true; }
function ma(){ if (map) { document.getElementById('map').innerHTML=''; map=false; } else { document.getElementById('map').innerHTML='<center><h2>Lista de tutoriais</h2></center>'+lista; map=true; } }
function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + '=' + escape(value) + ((expires) ? '; expires=' + expires.toGMTString() : '') +
((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + ((secure) ? '; secure' : ''); document.cookie = curCookie; }
function alter() { var e=document.getElementById('conexao');
var conec=new Array(33.2, 56.6, 256, 300, 512, 600, 1024); var now = new Date(); now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000); var txt=''; var vl=parseInt((kb/(conec[e.options[e.selectedIndex].value-1]/8))/60);
setCookie('conexao', e.options[e.options.selectedIndex].value,now, '/', 'cifraclub.terra.com.br');
if (vl==0) txt='Menos de 1 (um) minuto'; else txt=vl+' minutos'; document.getElementById('tm').innerHTML=txt;
} alter();
function baixarprograma(url,nome,id,tipo) {
	if(tipo==1){
		document.getElementById("download").innerHTML="<strong>Conectando ao servidor</strong><br /><br />O download do "+nome+" começará em alguns segundos. Caso isso não aconteça, <a href='"+url+"' target='_blank' >clique aqui</a>.<br><br><small style='float: right; margin-top: -15px;'>Link não funciona?<a href='link_quebrado.php?id_programa="+id+"'> Nos informe.</a></small>"; 
		document.getElementById("download").style.height='90px';
		document.getElementById("download2").innerHTML="<iframe src='"+url+"' width='0' height='0' border='0' scrolling='no'></iframe>";
	}

	var searchReq = getXmlHttpRequestObject();
	searchReq.open("GET", "soma_down.php?id="+id, true);
	searchReq.send(null); 
}

function getXmlHttpRequestObject(){
	try{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(e){
		try{
			return new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(ex){
			try{
				return new XMLHttpRequest();
			}
			catch(exc){
				alert("Esse browser não tem recursos para uso do Ajax");
				return null;
			}
		}
	}
}

function remove_elemento(elemento){
	elemento.parentNode.removeChild(elemento);
}

function remover_comentario(parametros, elmPai){
	var resposta = confirm('Tem certeza que deseja remover esse comentário?');
	if (resposta == true) {
		var searchReq = getXmlHttpRequestObject();
		searchReq.open("GET", "remove_comentario_programa.php?"+parametros, true);
		searchReq.onreadystatechange = function(){
			if (searchReq.readyState == 4){	
				var resp = eval('(' + searchReq.responseText + ')');
				if(resp.erro == false)
					remove_elemento(elmPai.parentNode);
			}
		};
		searchReq.send(null); 
	}
}

function editar_comentario(id, idElm){
	var id2 = idElm.replace('txt', '');
	document.frmcoment.action = "audioware.php?id_programa="+id+"&editar="+id2;
	var texto = document.getElementById(idElm).innerHTML;
	document.getElementById('boxcomentario').value = texto;
	document.getElementById('boxcomentario').focus();
}