function abrir(URL) {
   var width = 615;
   var height = 490;

   var left = 50;
   var top = 50;

   window.open(URL, 'item', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
} 

function abrir2(URL) {
   var width = 600;
   var height = 450;

   var left = 50;
   var top = 50;

   window.open(URL, 'item2', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
} 

function ampliar(URL, width, height) {
	
   var left = 50;
   var top = 50;

   window.open(URL, 'foto', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
} 

function validaComentar(){
	var nome = document.form1.nome.value;
	var comentario = document.form1.comentario.value;
	
	if(nome.length < 4){
		alert('Nome em branco ou muito curto.');
	return false;
	} else if(comentario.length < 10){
		alert('Comentario muito curto ou em branco.');
	return false;
	} else
		return true;
}

function validaCompra(){
		var caminho = document.form1;
	var nome = caminho.nome.value;
	var email = caminho.email.value;
	var endereco = caminho.endereco.value;
	var bairro = caminho.bairro.value;
	var cidade = caminho.cidade.value;	
	var telefone = caminho.telefone.value;
	if(nome.length < 4){
		alert('Nome muito curto.');
		return false;
	} else if(email.indexOf('@') < 1){
		alert('Email inválido.');
		return false;
	} else if(endereco.length < 5){
		alert('Endereço curto ou em branco.');
		return false;
	} else if(bairro.length < 5){
		alert('Bairro curto ou em branco.');
		return false;
	} else if(cidade.length < 5){
		alert('Cidade curto ou em branco.');
		return false;
	} else if(telefone.length < 6){
		alert('Telefone inválido.');
		return false;
	} else {
		return true;
	}
}

function ValidaEnviar(){
	var remetente = document.form1.remetente.value;
	var destinatario = document.form1.destinatario.value;
	var destinatario_email = document.form1.destinatario_email.value;
	if(remetente.length < 4){
		alert('Seu nome está em branco ou muito curto.');
		return false;
	} else if(destinatario.length < 5){
		alert('Nome de seu amigo em branco ou muito curto.');
		return false;
	} else if(destinatario_email.indexOf('@') < 1){
		alert('Email inválido.');
		return false;
	} else {
		return true;
	}
}