function confirmar(mensagem){
	var resp = confirm(mensagem);
	
	if(resp == false){
		return false;
	}
}

function emailValido(email){
	// não pode ser vazio, tem que conter "@", "."
	// e não pode conter espaços
	if (email == null || email.length == 0 ||
		email.indexOf(".") == -1 ||
		email.indexOf("@") == -1 ||
		email.indexOf(" ") != -1)
			return false;

    // testa os caracteres antes do "@"
	// não pode começar nem terminar com ponto
	// deve ter ao menos dois caracteres word (letras, números, underline)
	// opcionalmente com um ponto entre eles
	expressao=/(^\w{1,}\.?\w{1,})@/;
	confere = expressao.exec(email);
	if (!confere) return false;

	// testa os caracteres depois do "@"
    // deve ter ao menos 2 caracteres seguidos por um ponto, 
	// seguido por zero ou mais ocorrências de ao menos 2 
	// caracteres (terminando com um ponto), seguidos por 2 ou 3 caracteres

	expressao=/@(\w{2,}\.(\w{2,}\.)?[a-zA-Z]{2,3})$/;
	confere = expressao.exec(email);
	if(!confere)
		return false;

	return true;
}

function image_pop(titulo,image_path, winname, w, h){

	wscroll = 'no';

	maxw = window.screen.width*0.75;

	maxh = window.screen.height*0.75;

	

	if(w > maxw){w = maxw; wscroll = 'yes';}

	if(h > maxh){h = maxh; wscroll = 'yes';}

	

	win = window.open('about:blank', winname, 'scrollbars=' + wscroll + ', width = ' + w + ', height = ' + h + ', top = 1, left = 1');

	win.document.write("<html><head><title>"+titulo+"</title></head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\"><table width=100% height=100%><tr><td align=\"center\" valign=\"middle\" ><img onclick=\"self.close();\" src=\"" + image_path + "\" ></td></tr></table></body></html>");

	win.focus();
}
/*
function image_pop(titulo,image_path, winname, w, h){

	wscroll = 'no';

	maxw = window.screen.width*0.75;

	maxh = window.screen.height*0.75;

	

	if(w > maxw){w = maxw; wscroll = 'yes';}

	if(h > maxh){h = maxh; wscroll = 'yes';}

	

	win = window.open('about:blank', winname, 'scrollbars=' + wscroll + ', width = ' + w + ', height = ' + h + ', top = 1, left = 1');

	win.document.write("<html><head><title>"+titulo+"</title></head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\"><table width=100% height=100%><tr><td align=\"center\" valign=\"middle\" ><img onclick=\"self.close();\" src=\"" + image_path + "\" ></td></tr></table></body></html>");

	win.focus();
}
*/

function image_pop2(titulo,image_path, winname, w, h){ // Abre mais de um popup

	wscroll = 'no';

	maxw = window.screen.width*0.75;

	maxh = window.screen.height*0.75;

	

	if(w > maxw){w = maxw; wscroll = 'yes';}

	if(h > maxh){h = maxh; wscroll = 'yes';}

	

	win = window.open('about:blank', '', 'scrollbars=' + wscroll + ', width = ' + w + ', height = ' + h + ', top = 1, left = 1');	
	
	if(win == null) { 
		text = "Se a imagem não abrir\ntalvez seja porque você possui um\nprograma bloqueador de popup ativado!";
		
		alert(text);
		return; 
	}
	else{
	
	win.document.write("<html><head><title>"+titulo+"</title></head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\"><table width=100% height=100%><tr><td align=\"center\" valign=\"middle\" ><img onclick=\"self.close();\" src=\"" + image_path + "\" ></td></tr></table></body></html>");

	win.focus();
	}

}

function mudar_bgc(cb,tr){
	chk = document.getElementById(cb);
	lin = document.getElementById(tr);
	if (chk.checked){
		lin.style.background = '#EFB3B4';
	}
	else{
		lin.style.background = '';
	}
}

/////////////////////////////////
function remote(){
/*Credit: JavaScript Kit www.javascriptkit.com more JavaScripts here.*/
win=window.open("wc.htm","","width=180,height=380,scrollbars=no")
//interceptacao de erro na abertura da janela
text = "Se a janela nao estava abrindo\ntalvez seja porque voce tenha um\nprograma bloqueador de pop-up!\nObservacao » O windows XP service pack 2\nbloqueia pop-ups!";
if(win == null) { alert(text); return; }
//fim
//win2.creator=self;
}
/////////////////////////////////

function popup(id){
	win2 = window.open('mostra_autor.php?id=' + id, 'Autor','width = 400 , height = 200 ,scrollbars = yes, top = 10');
	win2.focus();
}
