// JavaScript Document
//=================================================================
// AJAX UPLOAD
var xmlhttp

function showHint(str){
	if (str.length==0){
		document.getElementById("txtHint").innerHTML="";
		return;
	}
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
		alert ("Seu navegador não suporta XMLHTTP!");
		return;
	}
	var url="modulos/suggest.php";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
	
function showHintApp(str){
	if (str.length==0){
		document.getElementById("txtHint").innerHTML="";
		return;
	}
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
		alert ("Seu navegador não suporta XMLHTTP!");
		return;
	}
	var url="modulos/sugeri_app.php";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
	
function showNews(str){
	if (str.length==0){
		document.getElementById("txtHint").innerHTML="";
		return;
	}
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
		alert ("Seu navegador não suporta XMLHTTP!");
		return;
	}
	var url="modulos/sugeri_news.php";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
	
function stateChanged(){
	if (xmlhttp.readyState==4){
		document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
	}
}
	
function GetXmlHttpObject(){
	if (window.XMLHttpRequest){
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject){
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}
//=================================================================
// SHOW / HIDE
//função para mostrar os elementos de 2º e 3º plano
function showHide(id){
   el = document.getElementById(id);
   el.style.display = (el.style.display != 'block')? 'block' : 'none';
}

function mostra(){
	document.getElementById('msg_fundo').style.visibility="visible";
	document.getElementById('msg').style.visibility="visible";
}
//função para esconder os elementos de 2º e 3º plano
function esconde(){
	document.getElementById('msg_fundo').style.visibility="hidden";
	document.getElementById('msg').style.visibility="hidden";
}

//=================================================================
// UPLOAD
function Upload() {
	file = document.getElementById("file");
	if ((file.value.length != null) && (file.value.length != "") && (file.value.length != "0")) {
		document.getElementById("capa").style.visibility="visible";
		document.getElementById("capa2").style.visibility="visible";
		return true;
	}
	return false;
}

function Vazio() {
    d = document.txt1;
    if (d.txt1.value == ""){
		alert("vazio");
		return false;
	}
}

//=================================================================
// JUMP MENU
function MM_jumpMenu(targ,selObj,restore)
{ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//
