var surl = 'http://www.technovision.com.br/admin/';

startList = function(){
	if(document.all&&document.getElementById){
		navRoot = document.getElementById("menu");
		for(i=0; i<navRoot.childNodes.length; i++){
			node = navRoot.childNodes[i];
			if(node.nodeName=="LI"){
				node.onmouseover=function(){
					this.className+=" over";
				}
				node.onmouseout=function(){
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
function enqMais(i){
        document.getElementById('m'+i).style.display = 'none';
        i++;
        document.getElementById('mopts').innerHTML += '<p><label for="alt'+i+'">Alternativa '+i+':</label><br /><input type="text" id="alt'+i+'" name="alt[]" /><a id="m'+i+'" class="btm" href="javascript:enqMais('+i+')">Mais</a></p>';
}
function data(dia,mes,ano){
	document.getElementById('data').value = mes+'/'+dia+'/'+ano;
	document.getElementById('mdata').innerHTML = dia+'/'+mes+'/'+ano+'<br /><a href="javascript:noDt();">[ Remover ]</a>';
}
function noDt(){
	document.getElementById('data').value = null;
	document.getElementById('hora').value = 0;
	document.getElementById('mdata').innerHTML = null;
}

function mCal(mnt,yar) {
	try{
       var xhttp = new ActiveXObject('Microsoft.XMLHTTP');
   }catch(E){
       var xhttp = new XMLHttpRequest();
   }
   var xurl = surl+'calendar.php?month='+mnt+'&year='+yar;

		xhttp.open('GET',xurl,true);
        xhttp.onreadystatechange=function(){
           if(xhttp.readyState==4){
		   	   eval(xhttp.responseText);
           }
       }
       xhttp.send(null);
}

function btDl(area){
	if(!confirm("Tem certeza que deseja excluir?")){
		return false;
	}else{
		var area;
		var id = document.getElementById('id').value;
		document.location.href=surl+'excluir/'+area+'/'+id;
		return true;
	}
}
function btCl(area){
	if(!confirm("Tem certeza que deseja cancelar?")){
		return false;
	}else{
		var area;
		document.location.href=surl+'editar/'+area;
		return true;
	}
}
function sClean(){
	document.getElementById('limpar').value="true";
	return true;
}
function tmbusca(){
    sft = document.getElementById("mbusca").value.toLowerCase();
	var saida = "";
    for(i=0;i<arr.length;i++){
        tag = arr[i].split(";");
        ntag = tag[0];
        atag = tag[1] + ' - ' + tag[2];
        vtag = atag.toLowerCase().search(sft);
        if(vtag != -1 && sft){
            saida = saida + "<li><a href=\"javascript:mtop(\'"+ ntag +"\',\'"+ atag.replace("\'","\\\\\'") +"\');\">" + atag.substring(0,vtag) + "<strong>" + atag.substring(vtag,vtag + sft.length) + "</strong>" + atag.substr(vtag + sft.length) + "</a></li>";
        }
    }
    document.getElementById("saida").innerHTML = "<ul>" + saida + "</ul>";
}
function mtop(id,nome){
    var id;
    var nome;
    var saida = "";
    var el = document.getElementById("top20");
    el.value += id + ",";
    
    document.getElementById("preview").innerHTML += '<li>' + cnt-- + ' - ' + nome + '</li>';
    document.getElementById("mbusca").select();
}