function addInput()
{
	var input = document.createElement('input');
	var n = parseInt(document.getElementById('nfoto').value) + 1;
	
	input.setAttribute('type', 'file');
	input.setAttribute('name', 'foto_'+n+'');
	input.setAttribute('id', 'foto_'+n+'');
	input.setAttribute('value', '');
	
	var add_input_div = document.getElementById('add_input_div');
	
	add_input_div.appendChild(input);
	
	document.getElementById('nfoto').value = n;

}

function maskDate(field) {
	x = document.getElementById(field).value;
	t = x.length;
	if ((t==2) || (t==5)) x = x+'/';
	document.getElementById(field).value = x;
}

function confSetores(query){
  if(window.confirm("Deseja realmente excluir este setor?")){
    window.location="painel.php?secao=setores&remove=TRUE" + query;
    return true;
  }
  else {
    return false;
  }
}

function confirmaLogout() {
 	if (confirm('Deseja realmente sair do sistema?')) {
		location.href = 'logout.php';
	}
}

function CheckAll()
{
count = document.frm.elements.length;
    for (i=0; i < count; i++) 
	{
    if(document.frm.elements[i].checked == 1)
    	{document.frm.elements[i].checked = 0; }
    else {document.frm.elements[i].checked = 1;}
	}
}

function CheckAll2()
{
count = document.frm2.elements.length;
    for (i=0; i < count; i++) 
	{
    if(document.frm2.elements[i].checked == 1)
    	{document.frm2.elements[i].checked = 0; }
    else {document.frm2.elements[i].checked = 1;}
	}
}

function verifica_Setores(){
if (document.frmSetores.nomeSetor.value=="") {
	alert("O nome do setor é obrigatório!")
	document.frmSetores.nomeSetor.focus()
	return false
	}
}


function verifica_Historia(){
if (document.frmHistoria.tituloHistoria.value=="") {
	alert("O titulo de história é obrigatório!")
	document.frmHistoria.tituloHistoria.focus()
	return false
	}

}

function verifica_Home(){
if (document.frmHome.tituloHome.value=="") {
	alert("O titulo da home é obrigatório!")
	document.frmHome.tituloHome.focus()
	return false
	}

}

function verifica_Estudio(){
if (document.frmEstudio.tituloEstudio.value=="") {
	alert("O titulo de estúdio é obrigatório!")
	document.frmEstudio.tituloEstudio.focus()
	return false
	}

}

function verifica_Estrada(){
if (document.frmEstrada.tituloEstrada.value=="") {
	alert("O titulo de pé na estrada é obrigatório!")
	document.frmEstrada.tituloEstrada.focus()
	return false
	}

}

function verifica_Amoresia(){
if (document.frmAmoresia.tituloAmoresia.value=="") {
	alert("O titulo de amoresia é obrigatório!")
	document.frmAmoresia.tituloAmoresia.focus()
	return false
	}

}

function verifica_Stilo(){
if (document.frmStilo.tituloStilo.value=="") {
	alert("O titulo de stilo shape é obrigatório!")
	document.frmStilo.tituloStilo.focus()
	return false
	}

}

function verifica_Gastro(){
if (document.frmGastro.tituloGastro.value=="") {
	alert("O titulo de gastrovida é obrigatório!")
	document.frmGastro.tituloGastro.focus()
	return false
	}

}

function verifica_Autitude(){
if (document.frmAutitude.tituloAutitude.value=="") {
	alert("O titulo de autitude é obrigatório!")
	document.frmAutitude.tituloAutitude.focus()
	return false
	}

}

function verifica_Joystick(){
if (document.frmJoystick.tituloJoystick.value=="") {
	alert("O titulo de joystick é obrigatório!")
	document.frmJoystick.tituloJoystick.focus()
	return false
	}

}

function verifica_VcBigg(){
if (document.frmVcBigg.tituloVcBigg.value=="") {
	alert("O titulo de vc BigG é obrigatório!")
	document.frmVcBigg.tituloVcBigg.focus()
	return false
	}

}

function verifica_CatShop(){
if (document.frmCatShop.nomeCatShop.value=="") {
	alert("O nome da categoria é obrigatório!")
	document.frmCatShop.nomeCatShop.focus()
	return false
	}
}

function verifica_Agenda(){
if (document.frmAgenda.eventoAgenda.value=="") {
	alert("O nome do evento é obrigatório!")
	document.frmAgenda.eventoAgenda.focus()
	return false
	}
if (document.frmAgenda.localAgenda.value=="") {
	alert("O local do evento é obrigatório!")
	document.frmAgenda.localAgenda.focus()
	return false
	}
if (document.frmAgenda.dataAgenda.value=="") {
	alert("A data do evento é obrigatório!")
	document.frmAgenda.dataAgenda.focus()
	return false
	}
if (document.frmAgenda.horaAgenda.value=="") {
	alert("A hora do evento é obrigatório!")
	document.frmAgenda.horaAgenda.focus()
	return false
	}
if (document.frmAgenda.valorAgenda.value=="") {
	alert("O preço do evento é obrigatório!")
	document.frmAgenda.valorAgenda.focus()
	return false
	}
if (document.frmAgenda.linkAgenda.value=="") {
	alert("O endereço do site do evento é obrigatório!")
	document.frmAgenda.linkAgenda.focus()
	return false
	}
}

function verifica_Letras(){
if (document.frmLetras.musicaLetras.value=="") {
	alert("O nome da música é obrigatório!")
	document.frmLetras.musicaLetras.focus()
	return false
	}
if (document.frmLetras.letraLetras.value=="") {
	alert("A letra da música é obrigatório!")
	document.frmLetras.letraLetras.focus()
	return false
	}
}


function verifica_Imprensa(){
if (document.frmImprensa.eventoImprensa.value=="") {
	alert("O nome do evento é obrigatório!")
	document.frmImprensa.eventoImprensa.focus()
	return false
	}

}

function verifica_Cabeca(){
if (document.frmCabeca.tituloCabeca.value=="") {
	alert("O título do cabeçalho é obrigatório!")
	document.frmCabeca.tituloCabeca.focus()
	return false
	}

if (document.frmCabeca.idSetores.value=="") {
	alert("O setor do cabeçalho é obrigatório!")
	document.frmCabeca.idSetores.focus()
	return false
	}
}

function verifica_Shop(){
if (document.frmShop.produtoShop.value=="") {
	alert("O nome do produto é obrigatório!")
	document.frmShop.produtoShop.focus()
	return false
	}

if (document.frmShop.precoShop.value=="") {
	alert("O preço do produto é obrigatório!")
	document.frmShop.precoShop.focus()
	return false
	}
if (document.frmShop.idCatShop.value=="0") {
	alert("A categoria do produto é obrigatório!")
	document.frmShop.idCatShop.focus()
	return false
	}
}

function verifica_Player(){
if (document.frmAudio.musicaPlayer.value=="") {
	alert("O nome da música é obrigatório!")
	document.frmAudio.musicaPlayer.focus()
	return false
	}
if (document.frmAudio.descPlayer.value=="") {
	alert("A descrição da música é obrigatório!")
	document.frmAudio.descPlayer.focus()
	return false
	}
if (document.frmAudio.albumPlayer.value=="") {
	alert("O nome do álbum é obrigatório!")
	document.frmAudio.albumPlayer.focus()
	return false
	}
}
