self.name = 'NEOMain';

function MM_preloadImages()	//v3.0
{
  var d=document;
  
  if(d.images)
  {
	if(!d.MM_p)
		d.MM_p=new Array();
	
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
	
	for(i=0; i<a.length; i++)
	
		if (a[i].indexOf("#")!=0)
		{
			d.MM_p[j]=new Image;
			d.MM_p[j++].src=a[i];
		}
	}
}

function SubMenu(number,action)
{
	if(action == false)
	{
		document.getElementById("Menu"+number).className = 'TextGreyBold10';
		document.getElementById("Sub"+number).style.display = 'none';
	}
	else
	{
		document.getElementById("Menu"+number).className = 'TextGreyBold10';
		document.getElementById("Sub"+number).style.display = 'block';
	}
}

function VerificaCaracter(c)
{
	nav = window.navigator.appName;
	
	if(nav == 'Microsoft Internet Explorer')
	{
		if(c <= 255)
			return true;
		else
			return false;
	}
	else
		return true;
}

function VerificaLogin(form)
{
	return false;
}

function VerificaPsqRx(form)
{
	error = false;

	if(form.Texto.value.length == 0)
	{
		error = 'Digite sua pesquisa.';
		form.Texto.focus();
	}
	else if(form.Free.checked == false && form.Protegido.checked == false)
		error = 'Escolha um tipo de imagem.';
	
	if(error != false)
	{
		alert(error);
		return false;
	}
	else
		return true;
}

function VerificaLogin(form)
{
	error = false;

	if(form.Usuario.value.length == 0)
	{
		error = 'Digite seu nome de usuário.';
		form.Usuario.focus();
	}
	else if(form.Senha.value.length == 0)
		error = 'Digite sua senha.';
	
	if(error != false)
	{
		alert(error);
		return false;
	}
	else
		return true;
}

function VerificaPsqCD(form)
{
	erro = false;

	if(form.Titulo.value.length == 0 && form.Content.value.length == 0 && form.Categoria.value == '')
	{
		erro = 'Digite sua pesquisa.';
		form.Titulo.focus();
	}
	else if(form.Titulo.value.length > 0 && form.Content.value.length > 0)
	{
		erro = 'Digite apenas em 1 campo.';
		form.Titulo.focus();
	}

	if(erro != false)
	{
		alert(erro);
		return false;
	}
	else
		return true;
}

function LightBox(photo)
{
	idv = 'val'+photo;
	val = document.getElementById(idv);

	if(val.value == 1)
		action2 = 0;
	else
		action2 = 1;
	
	idb = 'box'+photo;
	box = document.getElementById(idb);
	
	box.src = box.src.replace(val.value+'.gif',action2+'.gif');
	val.value = action2;

	window.open('ilightbox.php?Action='+val.value+'&Photo='+photo,'lightbox');
}

function Consulta(id)
{
	width = 420;
	height = 400;

	if(window.screen)
	{
		left = screen.width - width - 24;
		tope = 20;
	}
	else
	{
		left = 576;
		tope = 20;
	}

	window.open('consulta.php?id='+id,"NEOHelp3","width=" + width + ", height=" + height + ", top=" + tope + ", left=" + left + ", menubar=no, scrollbars=no, toolbar=no, location=no, resizable=no");
}

function VerificaLightbox(form)
{
	if(form.Nome.value.length == 0)
	{
		alert('Digite um nome para sua Lightbox.');
		form.Nome.focus();
		return false;
	}
	else
		return true;
}

function BoxRemove(id)
{
	if(confirm('Deseja remover esta imagem da lightbox?'))
		return true;
	else
		return false;
}

function ComoPesquisar()
{
	width = 240;
	height = 400;

	if(window.screen)
	{
		left = screen.width - width - 24;
		tope = 20;
	}
	else
	{
		left = 576;
		tope = 20;
	}

	window.open('howtosearch.php',"NEOHelp1","width=" + width + ", height=" + height + ", top=" + tope + ", left=" + left + ", menubar=no, scrollbars=yes, toolbar=no, location=no, resizable=no");
}

function SolicitarPesquisa()
{
	width = 420;
	height = 400;

	if(window.screen)
	{
		left = screen.width - width - 24;
		tope = 20;
	}
	else
	{
		left = 576;
		tope = 20;
	}

	window.open('request.php',"NEOHelp2","width=" + width + ", height=" + height + ", top=" + tope + ", left=" + left + ", menubar=no, scrollbars=yes, toolbar=no, location=no, resizable=no");
}

function EnviaLightbox(box)
{
	width = 420;
	height = 400;

	if(window.screen)
	{
		left = screen.width - width - 24;
		tope = 20;
	}
	else
	{
		left = 576;
		tope = 20;
	}

	window.open('sendbox.php?box='+box,"NEOSendBox","width=" + width + ", height=" + height + ", top=" + tope + ", left=" + left + ", menubar=no, scrollbars=no, toolbar=no, location=no, resizable=no");
}

function Download()
{
	alert("Windows: Para fazer o download desta imagem, clique com o botão \ndireito do mouse e escolha 'Salvar destino como...'\n\nMacintosh: Clique e arraste e então escolha 'Salvar como...'");
	return false;
}

function MudaFundo(stat,cor) {
	IMGobj = document.getElementById('imagemPreview');
	CORobj = document.getElementById('CorBar');
	BTCobj = document.getElementById('btMudaCor');
	TBLobj = document.getElementById('tabela');
	
	switch(stat) {
		case 1:
			CORobj.style.top = TBLobj.style.top+'280px';
			CORobj.style.right = TBLobj.style.right+'200px';
			CORobj.style.display = 'block';
			break;
		
		case 2:
			CORobj.style.display = 'none';
			break;
		
		case 0:
			IMGobj.style.background = cor;
			CORobj.style.display = 'block';
			break;
	}
}

function alteraLinguas(objeto) {
	// ---------------------------
	// Pega o objeto das checkbox
	// ---------------------------
	objBR = document.getElementById('porLN');
	objEN = document.getElementById('engLN');
	objLN = document.getElementById('campolingua');
	// -----
	// Case
	// -----
	switch (objeto) {
		case 'porLN':			
			objEN.checked = false;
			objBR.cheched = true;
			if ((objBR.checked == false) && (objEN.checked == false)) objBR.checked = true;
			// Muda as infos
			objLN.innerHTML = "<span style='color:#FFBB11; font-weight: bold'>e</span>, <span style='color:#FFBB11; font-weight: bold'>ou</span>, <span style='color:#FFBB11; font-weight: bold'>sem</span>";
		break;
		
		case 'engLN':		
			objBR.checked = false;
			objEN.checked = true;
			if ((objEN.checked == false) && (objBR.checked == false)) objEN.checked = true;
			// Muda as infos
			objLN.innerHTML = "<span style='color:#FFBB11; font-weight: bold'>and</span>, <span style='color:#FFBB11; font-weight: bold'>or</span>, <span style='color:#FFBB11; font-weight: bold'>not</span>";
		break;
	}	
}

function setTipo(pessoa) {
	switch (pessoa) {
		case '0':
			return false;
		break;
		
		case '1':
			obj1 = document.getElementById('corpo');
			obj1.style.display = "block";		
			obj2 = document.getElementById('layoutTemp');
			obj2.style.display = "none";
			obj3 = document.getElementById('corpoempresa');
			obj3.style.display = "none";
			obj4 = document.getElementById('corpocnpj');		
			obj4.style.display = "none";
			obj5 = document.getElementById('corpocpf');
			obj5.style.display = "block";
			obj6 = document.getElementById('corponome');
			obj6.innerHTML = "<strong>Nome:</strong>";
			obj7 = document.getElementById('verificaE');
			obj7.value = "cpf";
		break;
		
		case '2':
			obj1 = document.getElementById('corpo');
			obj1.style.display = "block";
			obj2 = document.getElementById('layoutTemp');
			obj2.style.display = "none";			
			obj3 = document.getElementById('corpoempresa');
			obj3.style.display = "block";
			obj4 = document.getElementById('corpocnpj');		
			obj4.style.display = "block";
			obj5 = document.getElementById('corpocpf');
			obj5.style.display = "none";
			obj6 = document.getElementById('corponome');			
			obj6.innerHTML = "<strong>Contato:</strong>";
			obj7 = document.getElementById('verificaE');
			obj7.value = "cnpj";			
		break;
	}
}

function abaKeyword(lingua) {
	objBR = document.getElementById('abaBR');
	objEN = document.getElementById('abaEN');
	switch(lingua) {
		case '1':
			objBR.style.display = "block";
			objEN.style.display = "none";
		break;
		
		case '2':
			objEN.style.display = "block";
			objBR.style.display = "none";			
		break;
	}
}
