self.name = 'AGBMain';

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 = 'TextGrey11';
		document.getElementById("Sub"+number).style.display = 'none';
	}
	else
	{
		document.getElementById("Menu"+number).className = 'TextWhite11';
		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,"AGBHelp3","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',"AGBHelp1","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',"AGBHelp2","width=" + width + ", height=" + height + ", top=" + tope + ", left=" + left + ", menubar=no, scrollbars=yes, toolbar=no, location=no, resizable=no");
}

function SolicitarPesquisa() {
	window.location.href = 'contato.php';
}

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,"AGBSendBox","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;
}